How do I animate a child node in a container?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By skitzoid

Containers are great keeping things ordered, and its fairly easy to add_child() or move_child() but when a new child is added it instantly appears. Is there a way to use Tweens to animate the position of all existing children whenever a new child enters?

I’ve tried adjusting rect_position and rect_global_position on both the children and container but it doesn’t appear to move anything. Specifically trying to change HBox & VBox containers with ColorRect nodes inside them (like an energy bar in FTL).

Any ideas?

Found this reddit post which says to create your own control class that handles its children, but thought that kinda defeats the purpose of containers if they’re only good for static children. Was hoping there might be a solution to this in the past 3 years?

skitzoid | 2022-05-23 08:15

Nope, I don’t think so. They’re still only good for static children.

exuin | 2022-05-23 16:27

Was looking for exact same thing - with expectation “it’s got to be easy…”; at least I know I need to figure out something different.

deear | 2022-09-30 22:04