Skip to content

Instantly share code, notes, and snippets.

createjs.Graphics.prototype.dashedLineTo = function( x1 , y1 , x2 , y2 , dashLen ){
this.moveTo( x1 , y1 );
var dX = x2 - x1;
var dY = y2 - y1;
var dashes = Math.floor(Math.sqrt( dX * dX + dY * dY ) / dashLen );
var dashX = dX / dashes;
var dashY = dY / dashes;
var q = 0;