Here's a concept of how we could manage state transitions in Framer. Currently, you can set a animationOptions property on a layer's state manager. Using the Events.StateWillSwitch notification, we should be able to change these attributes before a state change takes place, and by concatenating the state names we can create unique state-to-state transition options.
Last active
March 14, 2019 14:11
-
-
Save elliottkember/d714f2bfc8fde24c5406 to your computer and use it in GitHub Desktop.
Framer.js per-transition animationOptions!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
myLayer.states.stateAnimationOptions = | |
'a-b': | |
time: 0.1 | |
'b-c': | |
time: 0.8 | |
'c-d': | |
time: 0.5 | |
myLayer.states.add | |
a: opacity: 1 | |
b: opacity: 0 | |
c: opacity: 0.5 | |
myLayer.states.on Events.StateWillSwitch, (oldState, newState) -> | |
key = "#{oldState}-#{newState}" | |
if newAnimationOptions = myLayer.states.stateAnimationOptions?[key] | |
myLayer.states.animationOptions = _.merge myLayer.states.animationOptions, newAnimationOptions |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment