mirror of
https://github.com/photonstorm/phaser
synced 2024-11-28 07:31:11 +00:00
Added Curve.getDistancePoints
This commit is contained in:
parent
017eb32dd9
commit
a69e7a9b3f
1 changed files with 17 additions and 0 deletions
|
@ -90,6 +90,23 @@ var Curve = new Class({
|
|||
return points;
|
||||
},
|
||||
|
||||
// Return an array of points, spaced out X distance pixels apart
|
||||
getDistancePoints: function (distance)
|
||||
{
|
||||
var len = this.getLength();
|
||||
|
||||
var spaced = Math.max(1, len / distance);
|
||||
|
||||
return this.getSpacedPoints(spaced);
|
||||
|
||||
// Get the t value for 200 pixels along the curve
|
||||
// var t = curve.getTFromDistance(200);
|
||||
// = this.getUtoTmapping(0, distance, divisions)
|
||||
|
||||
// Get the point at t
|
||||
// var p = curve.getPoint(t);
|
||||
},
|
||||
|
||||
// Get sequence of points using getPointAt( u )
|
||||
|
||||
getSpacedPoints: function (divisions)
|
||||
|
|
Loading…
Reference in a new issue