0 votes

I'm wanting to draw boxes and UI elements with lines and such, and would like to animate their entrance onto the display. The problem is, I'd like to do it outside of the _process function, because if I've understood correctly, this function is called multiple times every frame, and once the animation is complete, there shouldn't be any more frame-to-frame processing. I'm wanting to something like this:

func _ready():
    animate_transition():

func animate_transition:
    [code for animation goes here]

How can I get an fps-independent animation without using the frame to frame functioning?

in Engine by (276 points)

2 Answers

+2 votes
Best answer

you can use set_process(false) after you finish, to stop the process function to run indefinetely.

Anyway, i dont know how to construct an animation from script, but you can easily set it in the editor (see link below) and then call animation.play("your_animation")

https://docs.godotengine.org/en/stable/getting_started/step_by_step/animations.html

by (1,514 points)
selected by

Great, thanks. As it turns out, I found a way to do what I wanted to do with tweens, but this would definitely help for other tasks.

–1 vote

I think what you are asking for is just the _physics_process(delta) function, it is called the same amount of time every seconds. I think it's what you are looking for

by (52 points)
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.