Canvas and CSS properties

Recommended Posts

Hey Guys!

I have a question! I wanted to know if there is a way  that when you click on a sprite can you set the css value for display to none for all other sprites - so essentially, when one sprite is clicked(chosen) all others display:none the chosen is set to display:block. I'm going for the effect of click on one character and it hides the others so you see your selected character and there bio(name, description etc...) appears next to them as display: block whereas all others are display: none. I am struggling as I can't call the sprite elements within the canvas by flat css - so was wandering if and how it is possible to achieve my hoped functionality!

This might be something for you @Wingnut?

Thankss! Mezz out!


Share this post

Link to post
Share on other sites

:) C'mon, Mezz... use your inventive ways.  CSS won't apply to sprites... but... you DO have ways of making some/any of them... disappear.

Does each sprite have a position.y?  Well, you could temporarily move all the OTHER sprites... to the moon, right? sprite.position.y = 100000 should send them well into the stratosphere, temporarily.  Then there's always width or height = 0;  Yeah, they're still there, but user needs an electron microscope to see them.  :) 

Would any of THESE demented ideas... work?  Not as clean as setEnabled(true/false), but still could work.

Share this post

Link to post
Share on other sites

You don't use in-browser object inspector, @Pryme8?  That shows all props and methods available on sprites and spriteManagers... and any other object.  Handy.  It will let you answer those easy questions.  Here's a nice little sprite playground to learn-from. 

Wasn't it you that sometimes gets grumpy... because people don't research, read, study, learn?  :D  hmm.

Share this post

Link to post
Share on other sites

So I found a nifty wow around it, now on sprite click it opens a modal box in html over the top of the canvas which has the high-res image of the sprite and the information, then when you click the cross it goes back to the canvas and babylon build - It works quite nicely atm! Can't wait to share the finished project @Wingnut im gonna be after those useful tips for improving the build before release!


Share this post

Link to post
Share on other sites

Good deal, Mezz! 

I'm NOT "Mr. Finishing Touches".  :D  (There are others here who are REALLY good at packaging, though)

I don't place my projects in a "released" or "not released" condition.  I'm anti-ownership-ism, so, my stuff is released from the first day of dev, and never with any finishing touches.  I doubt I have skills for making a project "finished".  But, I'm pretty good-at wrecking things, removing blinders, and pointing-at morally-ugly and stinky things.  Got any use for that skill-set?  (few do)

ANYTIME that ANY project... is deemed to have "advanced" a step... I'll pour whiskey, though.  If you have a motor vehicle, I'll help you play with it in a mud-hole, too.  I love gettin' muddy.  Some of the best times of my life... involved mud...  and a lot of laughing.  :)  Congrats on the advancement, Mezz.  Don't be too quick to label it as "done".  The "ongoing development" label is much more fun.  Yeah, you have visited "shadows" but have you visited "godrays"?  (VLS - volumetric light scattering).

Popup HTML panel?  Ohhh... Mezz... that is SO boring.  Sure, you have good CSS, overflow, scrolling, containment, form widgets, events, etc... but what fun is that? ;)

Why not FLY that plane into position, with a "swooosh" sound, and a trail of sparkly particles behind?  Wow!  Then it rocks a little... bleeding-off its final energy, like an old tin road sign rocking back and forth in the desert winds.  A little rusty squeaking sound, maybe.  Coooool.

Not HTML.  A BJS plane with an AdvancedDynamicTexture painted-onto it.  Yeah!

Then you can come-along with us Babylon GUI experimenters... who are attempting to re-create HTML form controls... using Babylon GUI custom controls.  (we're trying to expand Babylon GUI's toolkit)

It's a really painful process - I know you would LOVE IT.  :)  You have a BIG BIG future here, Mezzy!  Much more pain fun ahead!  heh.

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.