I’m trying to do two things, I’m trying to set a button element above the screen so that I can animate it popping down and then popping back up after a few seconds.
Hi i73. That playground uses a fullscreen gui, so you cannot place a control above the fullscreen canvas. There’s nothing up there to place it upon.
You COULD make your drop-down panel-o-GUI… be on a plane (not full screen). Perhaps parent the plane to the cam, position it high, and at display-time, lower the plane into cam-view… perfect.
Did you know controls can be zero-height? Does that give you an idea how to “fake” the drop-down panel? Make it LOOK LIKE its dropping-down, when it is actually increasing height, maybe with a little increasing .top, too?
Click on screen, to lower/raise the goo. Fun! Not sure if that will work for your project, but what the heck… it had to be tested. Stay tuned… possible better answers (and possibly better anim methods for control .height) ahead.
You might want to make a custom button class… that installs a raiser and dropper on each button you make (in case you need MANY). Each button might have its own timer… for how long to show it before raising. intelligent buttons… fortified with extra i73 vitamins. EACH ONE could be on its own plane. Wow. When each button has its own plane, all sorts of button-effects are possible.
Fades-ins and dissolve-outs, too. Or just make a particle explosion for entry/exit. You know you have it… when players play-with the GUI… more than they use the actual app.
That’ works perfectly, and I’ll do that, how would I be able to do that to an animation that plays then after a few seconds goes away? I’m just stuck on the animation properties.
The setIntervals (wait and run repeatedly) in the scene… those are for “doing things gradually”… slows-down the raising/lowering.
I think you could do it with standard keyframe animation, too. Lerp-meisters could probably use lerp-operations, too. I’m not the best animator. setTimeouts and setIntervals… might be distasteful to some. scene deltaTime methods and/or lerp methods… might be wiser… but I can’t teach you those, very well.
I’d like the icons to expand for one second then change then disappear once all done. I’m trying to understand the events like these but can’t seem to figure it out to my capacity.
I can’t either. I’m trying a “scaleTo” method overload on all Controls. What a mess. I got it counting from 2 to GO! but it misses 3 and 1. Something to do with onEnd being called twice per anim run. Still studying, but its lunch time now. Maybe you or others can help me get it running. It’s pretty close-to “button knows how to upscale, wait some time, then downscale”. (self-contained smart button). Not there yet.
I told you that I suck at animating… and its even worse for animating gui controls (as opposed to nodes like mesh, lights, and cams).
https://www.babylonjs-playground.com/#H03KNW#22 Use this #22 as a starter for your experiments. It overloads BABYLON.GUI.Button instead of BABYLON.GUI.Control. A little safer overload target… if overloading is EVER safe/wise.
Even safer would be… wait til after the button is made, and then do button.dropped = true; and button.scaleTo = function() {blah blah foo}; Then you are overloading only YOUR button, and not all buttons worldwide.
There’s some gurus nearby… watching us bleed… giggling at us and reminiscing about when THEY had these kinds of problems. They could fix us up in 10 minutes… I know they could… cuz they’re Gods. Let’s do a lot of moaning and sighing… see if we can get one to feel sorry for us… and help us out with wiser ways. heh.