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

What is Framer? Join the Community
Return to index
Kasper Andersen
Posted May 19 - Read on Facebook

I'm fooling around with States after being a .animate kind of guy for a long time.

I have a small question: I'm using the "onStateDidSwitch" event, but I only want to use it if the layer goes from Default to stateA.

Is there at way to say onStateDidSwitch from Default to stateA then switch do stateB, if onStateDidSwitch from stateB to stateC then switch to stateD, etc?

4 Comments

Andreas Wahlström

I think layer.states.current will help you here :)

Kasper Andersen

I'm trying this setup. The start works fine, the problem is when I click Compose the second time and it changes to "stateClose" then the "onStateDidSwitch" fires again and change it back to "stateB"

Jordan Robert Dobson

Use states did switch still but put your conditional inside the DidSwitch event function.

Jordan Robert Dobson

Similar to what you are doing above.

Read the entire post on Facebook