This is driving me crazy: I have a simple loop animation triggered by a toggle action, so click it would start the loop and click it again would stop it. My problem is that I can't figure out how to stop the loop… any ideas?
I was trying to make a good example but there is definitely a bug here that I need to look into. In your example, one thing you shouldn't do is keep adding "end" events to an animation with every start because they will all get called.
I'll look into this a bit more and get back to you.
Oh nice, thank you. I couldn't figure what was happening :)
One way to do this (not sure if it's best) would be to define a true/false variable before your function and add if statements inside your animation function. Then you can switch the true/false state of that variable with your utils.cycle.
Yes Gadzhi, that is also a good alternative, but I'd like to keep the code complexity as simple as possible. Let's hope Koen fix it soon :)
Even with a change in Framer you won't really get around Ghadzis suggestion I think.
Koen sorry, I don't understand what you mean…
Sorry. If you listen for the end event of an animation it's forever until you unlisten. So instead of starting the next animation immediately you want to check if the animation is still looping with a variable like Gadzhi suggests.