Kill Animations

Wondering if there is any way to kill an animation that’s set to run over time.
I have an animation (widget size) set to run over 12 seconds. I need to stop the animation and return the widget to its original size at some point before the 12 seconds is up.
Whenever I reset the size the animation continues an runs for the remainder of the 12 seconds.
So basically I need to kill the timer when I reset the size.
Any ideas?

There’s no way to stop the 12 second animation after you start it, BUT you can break it up into smaller chunks to allow a chance to stop it.

Have a look at the attached. I break up the animation into 60 200 ms chunks using a loop. The loop is conditional on a counter and text updated when the buttons are clicked. You can replace this with global variables if you prefer, or just hide them. I have them shown for illustration.

Each iteration of the loop adds 1/60 the size of the widget (my example doubles the size over the 12 seconds). You can use text on a widget or Global vars to hold the original size if you’d like rather than hard coding like I did. All logic is on the buttons. Probably need to adapt to fit your needs, but should get you going.

Holler if you have any questions!

BreakUpAnimation.rp (50.9 KB)

Hi and thanks! I thought about the solution you suggested…and did something similar using dynamic panel & using the OnPanelStateChange to advance the size animation…but seems a bit cumbersome for doing something that should be simple (like killAll or killTweensOf in TweenMax).

Thought there maybe a JS solution… clearInterval or something…

Thanks anyway!