how to play an animation with a changing speed?

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

I found there is custom_speed arg in play function, but when I set that with a variable which is changing in game, but the animation seems play at a same speed.

did you call play("name", -1, speed) after changing speed variable?

volzhs | 2019-01-31 10:15

Thanks for your reply, I don’t know I need to call the play function again when the speed variable changes to have the effect. I did that and it works.

hsjaaa | 2019-01-31 14:11

If you want to vary an animation’s speed over time, setting the playback_speed property on the AnimationPlayer instance may be more straightforward.

Calinou | 2019-01-31 15:44