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

What is Framer? Join the Community
Return to index
Antonio Krämer Fernandez
Posted May 27 - Read on Facebook

hey people, am I the only one who has trouble using states.switchInstant because its not working as expected?

e.g. I have a layer that animates to a state and during that animation I want to switch instantly to another state.
switchInstant doesnt really work for me here. Actually switchInstant just messes with the ongoing animation, but doesnt stop it and the layer still animates to the end of the previous animation.

I would expect that switchInstant is a short way of writing .states.switch("statename"), time: "0" . But this is not what happens and for me this often leads to a buggy behaviour.

I did a quick mockup to show and discuss this behaviour.

Press the red layer multiple times to see the switchInstant behaviour and the green layer for the time: "0" behaviour.

3 Comments

Johannes Eckert

You could try doing a .stopAnimate() before switchInstant to stop any running animation On the layer

Antonio Krämer Fernandez

Johannes Eckert thanks for the tip. But my point is if this is something that switchInstant should do automatically?

Antonio Krämer Fernandez

or maybe it is enough to mention in the docs that you can also write layerA.states.switch("stateA"), time: "0"

Read the entire post on Facebook