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

What is Framer? Join the Community
Return to index
Nicolas Russo-Larsson
Posted May 29 - Read on Facebook

What would be the best way to assign different animiationOptions to different states (of the same layer)?

for example when the layer switches from state "one" to "two" the animationOptions has a spring curve,
but when the layer switches from state "two" back to "one" the animationOptions has an ease curve with a 1 second delay


Chris Camargo

Set layer.states.animationOptions twice – once before you switch to state "two," and again before you switch back to state "one."

Nicolas Russo-Larsson

Chris yeah but is there an more efficient way to do so for many states using an if statement?

Nicolas Russo-Larsson

like if layer.states.current == "one" animationOptions should be...

Gabriel Lovato

You can set it if when you do the switch, i.e.
layer.on Events.TouchStart, ->
layer.states.switch "pressed", curve : "spring(600,40,0)"
layer.on Events.TouchEnd, ->
layer.states.switch "notPressed", curve : "spring(200,20,0)"

Chris Camargo

I didn't know that, Gabriel, good one! If only those pesky docs told us that. :)

Nicolas Russo-Larsson

Awesome! Thanks Gabriel Lovato

Jordan Robert Dobson

Yeah... that was brought to my attention a few weeks ago... It's not in the docs. :(

Balraj Chana

If you want to add infinite animationOptions to different states on the same layer without repeating yourself, here's how to do it with ease:

Read the entire post on Facebook