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

What is Framer? Join the Community
Return to index
Joshua Dickens
Posted Jan 11 - Read on Facebook

Is it possible to cancel an in-flight state transitions? I have a state transition with a 2s delay that can get triggered multiple times before it completes; I only want the stop any previous transitions and only play the *last* one. layer.animateStop() doesn't seem to work they way I'd think it would, for some reason.

1 Comments

Joshua Dickens

I think I figured out a solution; since the delay property in AnimationOptions is actually just a call to Utils.delay, I just create the delay myself and clear it only gets called once:

if(layer._delay)
clearTimeout(layer._delay)
layer._delay = Utils.delay 2, =>
this.states.switch("off",time: .25, curve: "ease")

Read the entire post on Facebook