Permalink
Browse files

Fix animate along path test

  • Loading branch information...
nvh committed Jan 24, 2018
1 parent 044f470 commit 370f5c84692ce8f087b22c7eeb35ececb92414c8
Showing with 12 additions and 8 deletions.
  1. +12 −8 test/tests/LayerAnimationTest.coffee
@@ -1273,24 +1273,28 @@ describe "LayerAnimation", ->
it "should animate along a path", (done) ->
svg = new SVGLayer
svg: '<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><path d="M 100 50 C 100 77.614 77.614 100 50 100 C 22.386 100 0 77.614 0 50 C 0 22.386 22.386 0 50 0" id="path" name="path" fill="transparent" stroke="#0AF"></path></svg>'
x: 123
y: 456
path = svg.elements.path
l = new Layer
size: 10
midX: path.start.x + path.parent.x
midY: path.start.y + path.parent.y
l.x.should.equal 95
l.y.should.equal 45
midX: path.start.x + path.x
midY: path.start.y + path.y
l.x.should.equal 95 + path.x
l.y.should.equal 45 + path.y
a = l.animate
x: path
y: path
rotation: path
options:
curve: Bezier.linear
time: 0.1
Utils.delay a.options.time / 2, ->
l.x.should.be.within(-5, 40)
l.y.should.be.within(40, 90)
l.x.should.be.within(-5 + path.x, 40 + path.y)
l.y.should.be.within(40 + path.y, 90 + path.y)
l.rotation.should.be.within(-90, 1)
a.onAnimationEnd ->
l.x.should.equal 45
l.y.should.equal -5
l.x.should.equal 45 + path.x
l.y.should.equal -5 + path.y
done()

0 comments on commit 370f5c8

Please sign in to comment.