Animation Sequencing Could Be Made Simpler
See original GitHub issueThe chaining together of multiple animations into animation sequences is a pretty common scenario, but doing it in Framer is more difficult than it should be. It could be made simpler with some improved APIs or shortcuts in the APIs. From http://framerjs.com/learn/basics/events/, you can see the canonical way of doing this is
layerA.animate
properties:
x: 200
curve: "ease-in-out"
layerA.on Events.AnimationEnd, ->
layerA.animate
properties:
x: 100
curve: "ease-in-out"
This is unwieldy with just one animation after another, and quickly gets out of hand when you have a set or 3 or more, and it becomes tricky to handle ordering. I could imagine instead an API that looks more like
layerA.animate(animationOptions).animate(animationOptions)
Animation objects could also support something similar like animation.chain(animation)
or animation.then(animation or function)
👈🏾 (I bet that second one will throw folks who know about promises for a loop but ¯_( ˘͡ ˘̯)_/¯). The point here is adding behaviors in an ordered sequence is common and should require less code to accomplish.
I could also imagine some shortcut way of doing this with states, the way you can easily cycle to the next one with next
. For illustration purposes (I’m sure there’s a better way), an example might be a new object with an API like animations for chaining animations between states.
seq = new Sequence(stateName1, stateName2, stateName3, ...)
seq.start()
Then again, maybe this would be easy enough if passing callback was easier, like proposed in https://github.com/koenbok/Framer/issues/111
Issue Analytics
- State:
- Created 8 years ago
- Reactions:5
- Comments:7 (2 by maintainers)
Top GitHub Comments
The way they do chaining is pretty great more specifically. But you are setting up an animation object first. On Tue, Aug 2, 2016 at 9:25 AM Jordan Dobson jordan@brothe.rs wrote:
Even with @uxdiogenes 's example there’s still the outstanding AnimationEnd listener may need cleaned up.