Animate in container

Godot Version

Godot 4.2


I have a vbox container with two children: the child on top is a picture, and on bottom is some UI elements. I’d like to animate the bottom, so that when the user clicks on a UI element, a set of new ones animate in from the bottom: so they start offscreen, then quickly rise up until they’re in the right spot.

I got this to work with a simple animationPlayer animation for position, but it doesn’t work if I change my game window to a larger size: when I do that, the element rises up too high. I assume this is related to the fact that I set the position in the animation, and it’s too small when the window is larger. Is there a good way to fix this, or a reasonable work around?

Have you tried using an anchor point to position at the bottom?

I haven’t, though I’m not sure what the best way to do that is: currently the VBox is in another vbox, so I don’t see an anchor option. Would that create a smooth animation? I assumed that it would just move the elements instantly from one anchor point to another.

I also figured out that it works if you adjust the strech mode, though it looks a little ugly.

storing (as a child) the needed to be animated node inside a Control node (with custom minimum size) will make it more feasible to be animated, else Vbox will restrict and fix the position of its child