How to animate something at consistent speed without _process?

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

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?

:bust_in_silhouette: Reply From: Andrea

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

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.

psear | 2020-06-01 18:49

:bust_in_silhouette: Reply From: ArthyChaux

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