Gradually faster animation speed (animated sprite 2D)

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Serenade
:warning: Old Version Published before Godot 3 was released.

Hey!
Im making an animation for my character (png sprites)
and im using a code where character cant stop and run instantly, it takes a second to reach max speed and to stop.
What code or command i need to use to control animation speed, loops per second, while an action(direction) is pressed?
Thank you!

:bust_in_silhouette: Reply From: Zylann

AnimatedSprite doesn’t have a speed parameter, because I guess it’s not that common to speed up a frame-by-frame animation. But there is a way:
When using AnimatedSprite, you put a SpriteFrames resource on it, and this one has a speed property: SpriteFrames — Godot Engine (latest) documentation in English
Now setting the speed on the resource will make all nodes using that resource also have that speed, but assuming your character has its own instance of the resource it should be fine.

don’t know why no one upvoted you… well, cheers… thanks!

wombatTurkey | 2017-07-07 10:01

What should i write in set_animation_speed ( String HERE?, float speed )

salomander86 | 2017-07-19 09:59

Try adapting this code:
AnimatedSprite.frames.set_animation_speed("animation_name", velocity)

rogarcadev | 2018-12-28 18:48