0 votes

There is a change in the Godot 3.1 regarding Control nodes (for UI elements). Let's say you have a title screen and you want to animate the name of the game, i.e. scroll it down from the top of the screen to the middle. When you create this animation through AnimationPlayer node with changing the rect position property, it looks ok in the editor but when you start the game the node is shifted to the side. It seems that right in the moment of the entire scene tree loads the precise position of all Control nodes is not known yet. Only after a while after the scene tree loads all these nodes are positioned properly and only after this is done you can animate them through rect position property.

I have tried to play the animation after signal resized() has been emitted and it worked fine. The problem is when you resize the game window - the signal gets emitted again and again and the animation starts again too. The solution is to add a check if the animation has been started already and start it only if it hasn't been. To me this is rather ugly solution to otherwise simple thing. Do you have any idea how to play the animation without the code?

in Engine by (72 points)

This sounds very specific, could you share a sample project?

It's not specific. Just create empty scene, add Label node to it, assign dynamic font and set anchors to center of the screen. Then create an animation animating Label. rect_position property. I.e. move the Label out of the top edge of the screen and animate it so it moves down to the center of the screen. When you run to scene the Label won't be centered.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.