Permalink
Browse files

Make state animation listen to options.start

  • Loading branch information...
nvh committed Oct 3, 2016
1 parent 32000eb commit a9c5455a6069f0697c9c49a45ec0d7dc92de1182
Showing with 11 additions and 2 deletions.
  1. +3 −2 framer/LayerStateMachine.coffee
  2. +8 −0 test/tests/LayerStatesTest.coffee
@@ -49,6 +49,7 @@ class exports.LayerStateMachine extends BaseClass
# might be different as they could be set by hand on the layer object.
# Grab the animation and make state switching have the same events (start, stop, end)
+ startAnimation = options.start ? true
options.start = false
animation = @layer.animate(properties, options)
@@ -73,8 +74,8 @@ class exports.LayerStateMachine extends BaseClass
animation.on(Events.AnimationStart, onStart)
animation.on(Events.AnimationStop, onStop)
animation.on(Events.AnimationEnd, onEnd)
-
- animation.start()
+
+ animation.start() if startAnimation
return animation
@@ -588,6 +588,14 @@ describe "LayerStates", ->
animation = layer.animate "test", time: 4
animation.options.time.should.equal 4
+ it "should listen to layer.animate options.start", ->
+ layer = new Layer
+ layer.states.test = {x: 100}
+ animation = layer.animate "test", start: false
+ animation.isAnimating.should.equal false
+ animation.start()
+ animation.isAnimating.should.equal true
+
describe "Callbacks", ->
it "should call start", (done) ->

0 comments on commit a9c5455

Please sign in to comment.