Permalink
Browse files

Fix finish() when called on animation with delay

  • Loading branch information...
nvh committed Oct 7, 2016
1 parent bed29aa commit 9f8be2619e8dee556d0600dc707fe34ab518b8fa
Showing with 12 additions and 6 deletions.
  1. +5 −5 framer/Animation.coffee
  2. +7 −1 test/tests/LayerAnimationTest.coffee
@@ -162,6 +162,11 @@ class exports.Animation extends BaseClass
@restart()
if not @looping
@_repeatCounter--

# Figure out what kind of values we have so we don't have to do it in
# the actual update loop. This saves a lot of frame budget.
@_prepareUpdateValues()

# If animate is false we set everything immediately and skip the actual animation
start = @_start

@@ -222,7 +227,6 @@ class exports.Animation extends BaseClass

_instant: =>
@emit(Events.AnimationStart)
@_prepareUpdateValues()
@_updateValues(1)
@emit(Events.AnimationStop)
@emit(Events.AnimationEnd)
@@ -239,10 +243,6 @@ class exports.Animation extends BaseClass
@emit(Events.AnimationStart)
Framer.Loop.on("update", @_update)

# Figure out what kind of values we have so we don't have to do it in
# the actual update loop. This saves a lot of frame budget.
@_prepareUpdateValues()

finish: =>
@stop()
@_updateValues(1)
@@ -244,7 +244,13 @@ describe "LayerAnimation", ->
x: 50
animation2.isNoop.should.be.equal true


it "In shouldn't crash when finish on delayed animation", ->
layer = new Layer
animation = layer.animate
x: 50
options:
delay: 1
animation.finish.should.not.throw()

describe "Context", ->

0 comments on commit 9f8be26

Please sign in to comment.