I have a constellation which i want to connect with lines. These lines need to be animated from a start point to an end point. I've provided an image to illustrate what i need as an end result:
All of these stars and lines are drawn with HTML5 canvas using easelJS. Provided bellow is my code so far, the "this.paths" variable contains x and y positions.
var graphics = this.shape.graphics;
graphics.beginStroke('#ffffff');
graphics.setStrokeStyle(1);
for(var i = 0; i < this.path.length; i++)
{
var path = this.path[i];
graphics.moveTo(path[0].x / 2, path[0].y / 2);
graphics.lineTo(path[0].x / 2, path[0].y / 2);
graphics.lineTo(path[1].x / 2, path[1].y / 2);
}
this.shape.alpha = 0.6;
Thanks in advance.
all that you need is already in this demo
http://www.createjs.com/demos/tweenjs/tween_sparktable
you've got a set of coordinates like (x1,y1) and (x2,y2). Now you need to use the Equation of a Straight Line and draw the lines dot by dot for smooth animation, just play with delays for satisfactory results. Seriously, the demo covers all of this and more, you even can edit it right there! I've played with the code a bit and here is your diagonal line, just paste this code there and run
Update:
here is another approach based on the simple tick method
http://jsfiddle.net/t21v9bo4/