Skip to content

Commit

Permalink
Add isPending flag
Browse files Browse the repository at this point in the history
  • Loading branch information
nvh committed Oct 7, 2016
1 parent 24d1b38 commit 705546c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
3 changes: 3 additions & 0 deletions framer/Animation.coffee
Expand Up @@ -82,6 +82,8 @@ class exports.Animation extends BaseClass
@define "layer", @define "layer",
get: -> @_layer get: -> @_layer


@define "isPending", get: -> @_delayTimer?

@define "isAnimating", @define "isAnimating",
get: -> @ in @layer.context.animations get: -> @ in @layer.context.animations


Expand Down Expand Up @@ -240,6 +242,7 @@ class exports.Animation extends BaseClass


_start: => _start: =>
@layer.context.addAnimation(@) @layer.context.addAnimation(@)
@_delayTimer = null
@emit(Events.AnimationStart) @emit(Events.AnimationStart)
Framer.Loop.on("update", @_update) Framer.Loop.on("update", @_update)


Expand Down
17 changes: 17 additions & 0 deletions test/tests/LayerAnimationTest.coffee
Expand Up @@ -400,6 +400,23 @@ describe "LayerAnimation", ->
layer.x.should.equal 0 layer.x.should.equal 0
done() done()


it "pending flag should be false by default", ->
layer = new Layer
a = layer.animate
x: 100
a.isPending.should.equal false
a.stop()

it "should add a pending flag for delayed animations", (done) ->
layer = new Layer
a = layer.animate
x: 100
options:
delay: 0.3
a.isPending.should.equal true
Utils.delay 0.3, ->
a.isPending.should.equal false
done()
describe "Repeat", -> describe "Repeat", ->


it "should start repeatedly", (done) -> it "should start repeatedly", (done) ->
Expand Down

0 comments on commit 705546c

Please sign in to comment.