Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reset animation state?

When I set :

animationSet.setFillAfter(true);

The view holds the animated state there after. But before doing another animation, I need to reset the state to the old one. What I need is something like :

animationSet.resetFillAfter(true);

How can I achieve this? Is it possible?

like image 555
Eldhose M Babu Avatar asked Sep 26 '12 12:09

Eldhose M Babu


People also ask

How to change the playing state of CSS animation?

Just for the record, you can also affect the playing state of a CSS animation through JavaScript, like pausing and restarting it. Obviously consider the other vendor prefixes properties. Interestingly, the natural end of a CSS animation doesn’t set the play state to “paused”.

Is there a way to restart a CSS animation?

With CSS animations (ala @keyframes) it’s not as easy as you might think to “restart” it. Let’s say you set it to run once: You have that run on, say, your logo: Then for some reason you want to have that animation run again, perhaps on a click. You might think CSS provides a way to kick it off again, but as far as I know it doesn’t.

Does the default animation change when you press any button?

Well, it depends. For example, when i start the game, my default animation is set to be idle. Then whenever i press any button, my animation transitions to another animation, when i stopped pressing any button it transitions back to my idle animation.

How to return the animatorcontroller to the entry state?

It returns the AnimatorController to the Entry state: This isn't the solution but there REALLY should be something as simple as Unity having some in-built function that when you use gameObject.SetActive (false); you can also select to save the object's states or not.


1 Answers

You can call yourView.clearAnimation()

like image 110
Alex Orlov Avatar answered Nov 16 '22 00:11

Alex Orlov