How to start animation after another animation ends?

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

I have three animations:
Run_start
Running
Run_end
If I press the start button, the animations should play one after the other. Three frames “Run_start”, loop “Running” and two frames “Run_end”.
I know you can use AnimationTree / state machine, but but maybe there is another way?
I would like to use AnimatedSprite or AnimationPlayer and manage from code.
I would be grateful if you could show me an example code.

:bust_in_silhouette: Reply From: DaddyMonster

Loads of ways to skin that cat. One way is to add a method call in the AnimationPlayer. They’re basically signals, when one finishes it will call a method which can call the next and string them as long as you like.

Speaking of signals, maybe an even easier option is to add an animation_finished signal to AnimationPlayer which passes the animation name, so it’s trivial to branch in code.