Pausing a running animation

Just to make sure before I add the feature request to Github: Is there a way to pause/unpause an animation?

In my game I use go.animate() on init() to start animations. When the game is running it would be handy to be able to pause them during events, then unpause them after the event has happened.

In my case it’s a portal that animates its position. I need to pause it as the player hits the portal, then unpause when they’ve come out the other end.

1 Like

There is no pause function.

A workaround would be to get the current value, cancel the animation, then restart the animation with a small “remainder” animation. I.e since you’ll likely to continue the animation from “the middle”, and not from the original start.

3 Likes

Okay, yeah that’s what I was thinking. Thanks!

An obvious advice. In similar situation I usually do not use go.animate but implement the animation in update via code. Of course this is worst performance-wise and need some time to write the code. However sometime is unavoidable.

Yes, because go.pause_animations() doesn’t exist, yet! :smiley:

Github issue: https://github.com/defold/defold/issues/5795

1 Like

+1 :slight_smile: