-
Notifications
You must be signed in to change notification settings - Fork 470
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to stop animation ? #14
Comments
Are you trying to pause an animation (stop it from advancing) or do you want to reset all the components to their original properties? |
how to reset animation or loop animation? |
You can use an instance FlareControls as the controller to your FlareActor widget. Take a look at how the Teddy example does this:
Essentially:
|
have you solved the case? I am trying to switch rotation animation to idle animation. It stops but rotation does not reset. any ideas? |
This is due to one of the most powerful features of Flare: it allows for animation mixing at indeterminate times. If you are playing two animations at indeterminate times, and you don't want to mix the results, you'll need to make sure that the animation that plays over/after resets the keyframes of the previous. For example: if you are rotating a square between 0 and 360 degrees making it spin in a loop, and then when you push a button you switch to an animation that slides the square from left to right, your slide animation needs to also reset the rotation to 0. Otherwise Flare will keep the rotation values previously applied. This allows you to do things like play both animations at once (rotate and slide) if your app needs to combine those states. |
@luigi-rosso What is the simplest example of reseting the progress of one animation to before beginning another? Or should I say where should I look for an example like this? |
You'd need to do it in the incoming animation. For example, one animation rotates something from 0-360, your other animation should reset that thing to whatever it expects it to be at (if it's not ok for it to be wherever the previous animation left it at). If you want to do it in code, one trick would be to re-instance the Artboard (when you instance an artboard all the components and their properties are set to the original design values). We don't have example code showing how to do this. Do you have a specific use case/sample file you can't get to work? I could try to make an example for you. |
It's hard to say without looking at the file, but you probably want to make sure you reset key values in animations that will play after another animation has changed those key properties. So if you know looping always changes the opacity of something, then an animation that plays after (like success) should reset that opacity to what it wants it to be. Flare does this automatically in the editor but not at runtime as there are cases where you intentionally want to mix multiple animations together. If your file is too complex and you don't want to take the time resetting the keyframes, you can create a custom widget that will re-instance the artboard when it plays the next state/animation. Oh thanks for uploading the file, I'll take a look! |
If you'd like me to setup an example that re-instances the artboard, could you email me an export of the .flr file (or attach it here if you don't mind sharing the export). You can email me at luigi@2dimensions.com |
The text was updated successfully, but these errors were encountered: