This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Abhishek Kumar
Posted Apr 08 - Read on Facebook

Hi guys. This is most likely a newbie question. I am trying to stop an animation loop in progress for a view. What's the right way to do this?

view1 = new View({width:100, height:100, x:50, y:50});

view1.opacity = 0.5;

animation1 = new Animation ({
view: view1,
properties: {opacity: 1.0},
curve: "ease-in",
time: 300
})

animation2 = animation1.reverse()

animation1.on("end", animation2.start)
animation2.on("end", animation1.start)

animation1.start()

view1.on("click", function() {

view1.animateStop()

})

5 Comments

Josh Puckett

Calling animation1.stop() will stop the animation. 'view1.animateStop()' does nothing.

Abhishek Kumar

Thanks Josh. Had tried that earlier too but it doesn't seem to be the solution either. The page seems to go into an endless loop and freezes up.

Koen Bok

Hmmm maybe we have a bug here. What about when you wrap the animationX.start function inside a function that checks if it needs to continue running with a variable?

Abhishek Kumar

Great! Thanks Koen.

Read the entire post on Facebook