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

What is Framer? Join the Community
Return to index
Jordan Robert Dobson
Posted Aug 19 - Read on Facebook

Is there a way to tie animation options to a state? I often want something to toggle between two states but with the in & out states having different animation speeds / distances / springs / etc...

8 Comments

Jordan Robert Dobson

Just wondering the best way to approach something like this. Would it be via detecting the current state and changing the animation options for the next transition/state change?

Jordan Robert Dobson

This is the comment that has me wondering how to do this: http://cl.ly/X7U8

John Anthony Evans

I think you can only call them as part of somelayer.states.switch("nameOfState", {curve:"spring(500,12,0)"})

Ed Chao

Elliott Kember put together a nice little gist just for this: https://gist.github.com/elliottkember/d714f2bfc8fde24c5406

Jordan Robert Dobson

^ I don't believe this is actually implemented? But that's pretty solid in the approach. I like the idea of having a-d being a possibility too. I haven't written a ton of CofeeScript so I think I get it... here's where I landed thus far: http://cl.ly/X6YO

Ed Chao

What you've got there is actually super similar. Both are setting the animation options on Statewillchange. Elliot is simply concatenating state names and using that as a key for the appropriate animation options.

Jordan Robert Dobson

^ I think I like what Elliott put together. make more sense. I assume then if you don't have a specific defined animation it would default to something. That would be awesome.

Read the entire post on Facebook