Jump to content
GreenSock

Estefania

Members
  • Posts

    1
  • Joined

  • Last visited

Estefania's Achievements

0

Reputation

  1. I'm having a problem when adding more points to the LinePath2D points array. A jump in the movement animation happens when new points are added. I'm using the example code from the docs and added a button, so when the button is pressed the new points are added. Here is my code: import com.greensock.*; import com.greensock.easing.*; import com.greensock.motionPaths.*; import flash.geom.Point; import flash.events.MouseEvent; var path:LinePath2D = new LinePath2D([new Point(0, 0), new Point(100, 100), new Point(350, 150), new Point(50, 200), new Point(550, 400)]); path.autoUpdatePoints=true; addChild(path); path.addFollower(createSquare(10, 0xFF0000), path.getSegmentProgress(2, 0.5)); TweenMax.to(path, 20, {progress:1}); function createSquare(size:Number, color:uint=0xFF0000):Shape { var s:Shape = new Shape(); s.graphics.beginFill(color, 1); s.graphics.drawRect(-size / 2, -size / 2, size, size); s.graphics.endFill(); this.addChild(s); return s; } function addMorePoints(e:MouseEvent){ btn.visible=false; var pathNew:Array = [new Point(700, 400), new Point(700, 600)]; path.appendMultiplePoints(pathNew); } btn.addEventListener(MouseEvent.MOUSE_DOWN, addMorePoints); Thanks for the help
×