Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stop an animation in C# / WPF?

Tags:

c#

wpf

I have something like this:

 barProgress.BeginAnimation(RangeBase.ValueProperty, new DoubleAnimation(     barProgress.Value, dNextProgressValue,     new Duration(TimeSpan.FromSeconds(dDuration))); 

Now, how would you stop that animation (the DoubleAnimation)? The reason I want to do this, is because I would like to start new animations (this seems to work, but it's hard to tell) and eventually stop the last animation...

like image 405
Daren Thomas Avatar asked Aug 21 '08 15:08

Daren Thomas


People also ask

How do you stop an animation code?

To stop an animator from playing the animation, simply, disable the animator component using this code: myAnimation. gameObject.

How do you stop the current running animation?

Introduction to jQuery stop animation. The jQuery stop animation is used to stops the currently running animations for the selected elements. The jQuery stop() function is used to immediately stop the animation. The jQuery stop() function is a built-in function in jQuery.

How do I stop a specific animation in unity?

For playing animation we can use Play() but for stopping the animation the Stop method is become obsolete in Unity 2019 or higher versions. So, For disable animation we can use enable flag and set it to false.

How do you stop an animation in canvas?

To stop animating, just set the flag to "stop": doAnim=false; Then if you later want to restart animating, you just reset the flag and call anim to start animating.


1 Answers

To stop it, call BeginAnimation again with the second argument set to null.

like image 91
TheSmurf Avatar answered Sep 22 '22 06:09

TheSmurf