Permalink
Browse files

Not returning pending animations from layer.animations() by default

  • Loading branch information...
nvh committed Oct 7, 2016
1 parent a9e75d4 commit 35513f1f93ad0ded040bd20ef8fe93217c6e5ee3
Showing with 36 additions and 2 deletions.
  1. +3 −2 framer/Layer.coffee
  2. +33 −0 test/tests/LayerAnimationTest.coffee
View
@@ -940,10 +940,11 @@ class exports.Layer extends BaseClass
return @animate(stateName, options) if options.animate is true
return @animate(stateName, _.defaults({}, options, {instant:true}))
animations: ->
animations: (includePending=false)->
# Current running animations on this layer
_.filter @_context.animations, (animation) =>
animation.layer is @
return false unless (animation.layer is @)
return includePending or not animation.isPending
animatingProperties: ->
@@ -287,6 +287,39 @@ describe "LayerAnimation", ->
animation.on "end", test
animation.on "stop", test
it "shouldn't return delayed animations from layer.animations()", (done) ->
layer = new Layer()
animation = layer.animate
x: 100
options:
time: 0.1
delay: 0.1
count = 0
test = ->
layer.animations().length.should.equal 0
count++
if count is 3
done()
test()
animation.on "end", test
animation.on "stop", test
it "should return delayed animations when calling layer.animations(true)", (done) ->
layer = new Layer
animation = layer.animate
x: 100
options:
time: 0.1
delay: 0.1
count = 0
test = ->
(animation in layer.animations(true)).should.equal true
count++
if count is 2
done()
test()
animation.on "start", test
it "should tell you if animations are running", ->
layer = new Layer()

0 comments on commit 35513f1

Please sign in to comment.