mirror of
https://github.com/photonstorm/phaser
synced 2025-02-26 04:17:08 +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 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 )
|
// Get sequence of points using getPointAt( u )
|
||||||
|
|
||||||
getSpacedPoints: function (divisions)
|
getSpacedPoints: function (divisions)
|
||||||
|
|
Loading…
Add table
Reference in a new issue