mirror of
https://github.com/photonstorm/phaser
synced 2024-11-24 21:53:59 +00:00
JSDoc blocks added.
This commit is contained in:
parent
b28962e442
commit
498e1215f5
37 changed files with 427 additions and 9 deletions
|
@ -9,22 +9,79 @@ var Curve = new Class({
|
||||||
|
|
||||||
initialize:
|
initialize:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @class Curve
|
||||||
|
* @memberOf Phaser.Curves
|
||||||
|
* @constructor
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @param {string} type - [description]
|
||||||
|
*/
|
||||||
function Curve (type)
|
function Curve (type)
|
||||||
{
|
{
|
||||||
// String based identifier
|
/**
|
||||||
|
* String based identifier
|
||||||
|
*
|
||||||
|
* @property {string} type
|
||||||
|
*/
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @property {integer} defaultDivisions
|
||||||
|
* @default 5
|
||||||
|
*/
|
||||||
this.defaultDivisions = 5;
|
this.defaultDivisions = 5;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @property {integer} arcLengthDivisions
|
||||||
|
* @default 100
|
||||||
|
*/
|
||||||
this.arcLengthDivisions = 100;
|
this.arcLengthDivisions = 100;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @property {array} cacheArcLengths
|
||||||
|
* @default []
|
||||||
|
*/
|
||||||
this.cacheArcLengths = [];
|
this.cacheArcLengths = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @property {boolean} needsUpdate
|
||||||
|
* @default true
|
||||||
|
*/
|
||||||
this.needsUpdate = true;
|
this.needsUpdate = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @property {boolean} active
|
||||||
|
* @default true
|
||||||
|
*/
|
||||||
this.active = true;
|
this.active = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @property {Phaser.Math.Vector2} _tmpVec2A
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
this._tmpVec2A = new Vector2();
|
this._tmpVec2A = new Vector2();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @property {Phaser.Math.Vector2} _tmpVec2B
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
this._tmpVec2B = new Vector2();
|
this._tmpVec2B = new Vector2();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,14 @@
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @method Phaser.Curves.Curve#draw
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @param {Phaser.GameObjects.Graphics} graphics - [description]
|
||||||
|
* @param {integer} [pointsTotal=32] - [description]
|
||||||
|
*
|
||||||
|
* @return {Phaser.GameObjects.Graphics} [description]
|
||||||
|
*/
|
||||||
var Draw = function (graphics, pointsTotal)
|
var Draw = function (graphics, pointsTotal)
|
||||||
{
|
{
|
||||||
if (pointsTotal === undefined) { pointsTotal = 32; }
|
if (pointsTotal === undefined) { pointsTotal = 32; }
|
||||||
|
|
|
@ -1,6 +1,17 @@
|
||||||
var FromPoints = require('../../../geom/rectangle/FromPoints');
|
var FromPoints = require('../../../geom/rectangle/FromPoints');
|
||||||
var Rectangle = require('../../../geom/rectangle/Rectangle');
|
var Rectangle = require('../../../geom/rectangle/Rectangle');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @method Phaser.Curves.Curve#getBounds
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @param {Phaser.Geom.Rectangle} out - [description]
|
||||||
|
* @param {integer} [accuracy=16] - [description]
|
||||||
|
*
|
||||||
|
* @return {Phaser.Geom.Rectangle} [description]
|
||||||
|
*/
|
||||||
var GetBounds = function (out, accuracy)
|
var GetBounds = function (out, accuracy)
|
||||||
{
|
{
|
||||||
if (out === undefined) { out = new Rectangle(); }
|
if (out === undefined) { out = new Rectangle(); }
|
||||||
|
|
|
@ -1,4 +1,15 @@
|
||||||
// Return an array of points, spaced out X distance pixels apart
|
// Return an array of points, spaced out X distance pixels apart
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @method Phaser.Curves.Curve#getDistancePoints
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @param {integer} distance - [description]
|
||||||
|
*
|
||||||
|
* @return {Phaser.Geom.Point[]} [description]
|
||||||
|
*/
|
||||||
var GetDistancePoints = function (distance)
|
var GetDistancePoints = function (distance)
|
||||||
{
|
{
|
||||||
var len = this.getLength();
|
var len = this.getLength();
|
||||||
|
@ -6,13 +17,6 @@ var GetDistancePoints = function (distance)
|
||||||
var spaced = Math.max(1, len / distance);
|
var spaced = Math.max(1, len / distance);
|
||||||
|
|
||||||
return this.getSpacedPoints(spaced);
|
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);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = GetDistancePoints;
|
module.exports = GetDistancePoints;
|
||||||
|
|
|
@ -1,5 +1,15 @@
|
||||||
var Vector2 = require('../../../math/Vector2');
|
var Vector2 = require('../../../math/Vector2');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @method Phaser.Curves.Curve#getEndPoint
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @param {Phaser.Math.Vector2} out - [description]
|
||||||
|
*
|
||||||
|
* @return {Phaser.Math.Vector2} [description]
|
||||||
|
*/
|
||||||
var GetEndPoint = function (out)
|
var GetEndPoint = function (out)
|
||||||
{
|
{
|
||||||
if (out === undefined) { out = new Vector2(); }
|
if (out === undefined) { out = new Vector2(); }
|
||||||
|
|
|
@ -1,5 +1,13 @@
|
||||||
// Get total curve arc length
|
// Get total curve arc length
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @method Phaser.Curves.Curve#getLength
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @return {number} [description]
|
||||||
|
*/
|
||||||
var GetLength = function ()
|
var GetLength = function ()
|
||||||
{
|
{
|
||||||
var lengths = this.getLengths();
|
var lengths = this.getLengths();
|
||||||
|
|
|
@ -1,5 +1,15 @@
|
||||||
// Get list of cumulative segment lengths
|
// Get list of cumulative segment lengths
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @method Phaser.Curves.Curve#getLengths
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @param {integer} [divisions] - [description]
|
||||||
|
*
|
||||||
|
* @return {number[]} [description]
|
||||||
|
*/
|
||||||
var GetLengths = function (divisions)
|
var GetLengths = function (divisions)
|
||||||
{
|
{
|
||||||
if (divisions === undefined) { divisions = this.arcLengthDivisions; }
|
if (divisions === undefined) { divisions = this.arcLengthDivisions; }
|
||||||
|
|
|
@ -2,6 +2,17 @@
|
||||||
|
|
||||||
// - u [0 .. 1]
|
// - u [0 .. 1]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @method Phaser.Curves.Curve#getPointAt
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @param {float} u - [description]
|
||||||
|
* @param {Phaser.Math.Vector2} [out] - [description]
|
||||||
|
*
|
||||||
|
* @return {Phaser.Math.Vector2} [description]
|
||||||
|
*/
|
||||||
var GetPointAt = function (u, out)
|
var GetPointAt = function (u, out)
|
||||||
{
|
{
|
||||||
var t = this.getUtoTmapping(u);
|
var t = this.getUtoTmapping(u);
|
||||||
|
|
|
@ -1,5 +1,15 @@
|
||||||
// Get sequence of points using getPoint( t )
|
// Get sequence of points using getPoint( t )
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @method Phaser.Curves.Curve#getPoints
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @param {integer} [divisions] - [description]
|
||||||
|
*
|
||||||
|
* @return {Phaser.Math.Vector2[]} [description]
|
||||||
|
*/
|
||||||
var GetPoints = function (divisions)
|
var GetPoints = function (divisions)
|
||||||
{
|
{
|
||||||
if (divisions === undefined) { divisions = this.defaultDivisions; }
|
if (divisions === undefined) { divisions = this.defaultDivisions; }
|
||||||
|
|
|
@ -1,5 +1,15 @@
|
||||||
// Get sequence of points using getPointAt( u )
|
// Get sequence of points using getPointAt( u )
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @method Phaser.Curves.Curve#getSpacedPoints
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @param {integer} [divisions] - [description]
|
||||||
|
*
|
||||||
|
* @return {Phaser.Math.Vector2[]} [description]
|
||||||
|
*/
|
||||||
var GetSpacedPoints = function (divisions)
|
var GetSpacedPoints = function (divisions)
|
||||||
{
|
{
|
||||||
if (divisions === undefined) { divisions = this.defaultDivisions; }
|
if (divisions === undefined) { divisions = this.defaultDivisions; }
|
||||||
|
|
|
@ -1,5 +1,15 @@
|
||||||
var Vector2 = require('../../../math/Vector2');
|
var Vector2 = require('../../../math/Vector2');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @method Phaser.Curves.Curve#getStartPoint
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @param {Phaser.Math.Vector2} [out] - [description]
|
||||||
|
*
|
||||||
|
* @return {Phaser.Math.Vector2} [description]
|
||||||
|
*/
|
||||||
var GetStartPoint = function (out)
|
var GetStartPoint = function (out)
|
||||||
{
|
{
|
||||||
if (out === undefined) { out = new Vector2(); }
|
if (out === undefined) { out = new Vector2(); }
|
||||||
|
|
|
@ -1,4 +1,15 @@
|
||||||
// Given a distance in pixels, get a t to find p.
|
// Given a distance in pixels, get a t to find p.
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @method Phaser.Curves.Curve#getTFromDistance
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @param {integer} distance - [description]
|
||||||
|
* @param {integer} [divisions] - [description]
|
||||||
|
*
|
||||||
|
* @return {float} [description]
|
||||||
|
*/
|
||||||
var GetTFromDistance = function (distance, divisions)
|
var GetTFromDistance = function (distance, divisions)
|
||||||
{
|
{
|
||||||
if (distance <= 0)
|
if (distance <= 0)
|
||||||
|
|
|
@ -5,6 +5,17 @@ var Vector2 = require('../../../math/Vector2');
|
||||||
// 2 points a small delta apart will be used to find its gradient
|
// 2 points a small delta apart will be used to find its gradient
|
||||||
// which seems to give a reasonable approximation
|
// which seems to give a reasonable approximation
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @method Phaser.Curves.Curve#getTangent
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @param {number} t - [description]
|
||||||
|
* @param {Phaser.Math.Vector2} [out] - [description]
|
||||||
|
*
|
||||||
|
* @return {Phaser.Math.Vector2} [description]
|
||||||
|
*/
|
||||||
var GetTangent = function (t, out)
|
var GetTangent = function (t, out)
|
||||||
{
|
{
|
||||||
if (out === undefined) { out = new Vector2(); }
|
if (out === undefined) { out = new Vector2(); }
|
||||||
|
|
|
@ -1,3 +1,14 @@
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @method Phaser.Curves.Curve#getTangentAt
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @param {float} u - [description]
|
||||||
|
* @param {Phaser.Math.Vector2} [out] - [description]
|
||||||
|
*
|
||||||
|
* @return {Phaser.Math.Vector2} [description]
|
||||||
|
*/
|
||||||
var GetTangentAt = function (u, out)
|
var GetTangentAt = function (u, out)
|
||||||
{
|
{
|
||||||
var t = this.getUtoTmapping(u);
|
var t = this.getUtoTmapping(u);
|
||||||
|
|
|
@ -1,5 +1,17 @@
|
||||||
// Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equidistant
|
// Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equidistant
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @method Phaser.Curves.Curve#getUtoTmapping
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @param {float} u - [description]
|
||||||
|
* @param {integer} distance - [description]
|
||||||
|
* @param {integer} [divisions] - [description]
|
||||||
|
*
|
||||||
|
* @return {number} [description]
|
||||||
|
*/
|
||||||
var GetUtoTmapping = function (u, distance, divisions)
|
var GetUtoTmapping = function (u, distance, divisions)
|
||||||
{
|
{
|
||||||
var arcLengths = this.getLengths(divisions);
|
var arcLengths = this.getLengths(divisions);
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @method Phaser.Curves.Curve#updateArcLengths
|
||||||
|
* @since 3.0.0
|
||||||
|
*/
|
||||||
var UpdateArcLengths = function ()
|
var UpdateArcLengths = function ()
|
||||||
{
|
{
|
||||||
this.needsUpdate = true;
|
this.needsUpdate = true;
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @method Phaser.Curves.Path#add
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @param {Phaser.Curves.Curve} curve - [description]
|
||||||
|
*
|
||||||
|
* @return {Phaser.Curves.Path} [description]
|
||||||
|
*/
|
||||||
var Add = function (curve)
|
var Add = function (curve)
|
||||||
{
|
{
|
||||||
this.curves.push(curve);
|
this.curves.push(curve);
|
||||||
|
|
|
@ -1,3 +1,15 @@
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @method Phaser.Curves.Path#circleTo
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @param {number} radius - [description]
|
||||||
|
* @param {boolean} [clockwise] - [description]
|
||||||
|
* @param {number} [rotation] - [description]
|
||||||
|
*
|
||||||
|
* @return {Phaser.Curves.Path} [description]
|
||||||
|
*/
|
||||||
var CircleTo = function (radius, clockwise, rotation)
|
var CircleTo = function (radius, clockwise, rotation)
|
||||||
{
|
{
|
||||||
if (clockwise === undefined) { clockwise = false; }
|
if (clockwise === undefined) { clockwise = false; }
|
||||||
|
|
|
@ -1,5 +1,13 @@
|
||||||
var LineCurve = require('../../line/LineCurve');
|
var LineCurve = require('../../line/LineCurve');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @method Phaser.Curves.Path#closePath
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @return {Phaser.Curves.Path} [description]
|
||||||
|
*/
|
||||||
var ClosePath = function ()
|
var ClosePath = function ()
|
||||||
{
|
{
|
||||||
// Add a line curve if start and end of lines are not connected
|
// Add a line curve if start and end of lines are not connected
|
||||||
|
|
|
@ -3,6 +3,21 @@ var Vector2 = require('../../../math/Vector2');
|
||||||
|
|
||||||
// Creates a cubic bezier curve starting at the previous end point and ending at p3, using p1 and p2 as control points
|
// Creates a cubic bezier curve starting at the previous end point and ending at p3, using p1 and p2 as control points
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @method Phaser.Curves.Path#cubicBezierTo
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @param {number} x - [description]
|
||||||
|
* @param {number} y - [description]
|
||||||
|
* @param {Phaser.Math.Vector2} control1X - [description]
|
||||||
|
* @param {Phaser.Math.Vector2} control1Y - [description]
|
||||||
|
* @param {Phaser.Math.Vector2} control2X - [description]
|
||||||
|
* @param {Phaser.Math.Vector2} control2Y - [description]
|
||||||
|
*
|
||||||
|
* @return {Phaser.Curves.Path} [description]
|
||||||
|
*/
|
||||||
var CubicBezierTo = function (x, y, control1X, control1Y, control2X, control2Y)
|
var CubicBezierTo = function (x, y, control1X, control1Y, control2X, control2Y)
|
||||||
{
|
{
|
||||||
var p0 = this.getEndPoint();
|
var p0 = this.getEndPoint();
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @method Phaser.Curves.Path#destroy
|
||||||
|
* @since 3.0.0
|
||||||
|
*/
|
||||||
var Destroy = function ()
|
var Destroy = function ()
|
||||||
{
|
{
|
||||||
this.curves.length = 0;
|
this.curves.length = 0;
|
||||||
|
|
|
@ -1,3 +1,14 @@
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @method Phaser.Curves.Path#draw
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @param {Phaser.GameObjects.Graphics} graphics - [description]
|
||||||
|
* @param {integer} [pointsTotal=32] - [description]
|
||||||
|
*
|
||||||
|
* @return {Phaser.GameObjects.Graphics} [description]
|
||||||
|
*/
|
||||||
var Draw = function (graphics, pointsTotal)
|
var Draw = function (graphics, pointsTotal)
|
||||||
{
|
{
|
||||||
for (var i = 0; i < this.curves.length; i++)
|
for (var i = 0; i < this.curves.length; i++)
|
||||||
|
|
|
@ -1,6 +1,22 @@
|
||||||
var EllipseCurve = require('../../ellipse/EllipseCurve');
|
var EllipseCurve = require('../../ellipse/EllipseCurve');
|
||||||
|
|
||||||
// Creates an ellipse curve positioned at the previous end point, using the given parameters
|
// Creates an ellipse curve positioned at the previous end point, using the given parameters
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @method Phaser.Curves.Path#ellipseTo
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @param {number} xRadius - [description]
|
||||||
|
* @param {number} yRadius - [description]
|
||||||
|
* @param {number} startAngle - [description]
|
||||||
|
* @param {number} endAngle - [description]
|
||||||
|
* @param {boolean} clockwise - [description]
|
||||||
|
* @param {number} rotation - [description]
|
||||||
|
*
|
||||||
|
* @return {Phaser.Curves.Path} [description]
|
||||||
|
*/
|
||||||
var EllipseTo = function (xRadius, yRadius, startAngle, endAngle, clockwise, rotation)
|
var EllipseTo = function (xRadius, yRadius, startAngle, endAngle, clockwise, rotation)
|
||||||
{
|
{
|
||||||
var ellipse = new EllipseCurve(0, 0, xRadius, yRadius, startAngle, endAngle, clockwise, rotation);
|
var ellipse = new EllipseCurve(0, 0, xRadius, yRadius, startAngle, endAngle, clockwise, rotation);
|
||||||
|
|
|
@ -3,6 +3,16 @@ var EllipseCurve = require('../../ellipse/EllipseCurve');
|
||||||
var LineCurve = require('../../line/LineCurve');
|
var LineCurve = require('../../line/LineCurve');
|
||||||
var SplineCurve = require('../../spline/SplineCurve');
|
var SplineCurve = require('../../spline/SplineCurve');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @method Phaser.Curves.Path#fromJSON
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @param {object} data - [description]
|
||||||
|
*
|
||||||
|
* @return {Phaser.Curves.Path} [description]
|
||||||
|
*/
|
||||||
var FromJSON = function (data)
|
var FromJSON = function (data)
|
||||||
{
|
{
|
||||||
// data should be an object matching the Path.toJSON object structure.
|
// data should be an object matching the Path.toJSON object structure.
|
||||||
|
|
|
@ -1,5 +1,16 @@
|
||||||
var Rectangle = require('../../../geom/rectangle/Rectangle');
|
var Rectangle = require('../../../geom/rectangle/Rectangle');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @method Phaser.Curves.Path#getBounds
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @param {Phaser.Geom.Rectangle} [out] - [description]
|
||||||
|
* @param {integer} [accuracy=16] - [description]
|
||||||
|
*
|
||||||
|
* @return {Phaser.Geom.Rectangle} [description]
|
||||||
|
*/
|
||||||
var GetBounds = function (out, accuracy)
|
var GetBounds = function (out, accuracy)
|
||||||
{
|
{
|
||||||
if (out === undefined) { out = new Rectangle(); }
|
if (out === undefined) { out = new Rectangle(); }
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @method Phaser.Curves.Path#getCurveLengths
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @return {array} [description]
|
||||||
|
*/
|
||||||
var GetCurveLengths = function ()
|
var GetCurveLengths = function ()
|
||||||
{
|
{
|
||||||
// We use cache values if curves and cache array are same length
|
// We use cache values if curves and cache array are same length
|
||||||
|
|
|
@ -1,5 +1,15 @@
|
||||||
var Vector2 = require('../../../math/Vector2');
|
var Vector2 = require('../../../math/Vector2');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @method Phaser.Curves.Path#getEndPoint
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @param {Phaser.Math.Vector2} [out] - [description]
|
||||||
|
*
|
||||||
|
* @return {Phaser.Math.Vector2} [description]
|
||||||
|
*/
|
||||||
var GetEndPoint = function (out)
|
var GetEndPoint = function (out)
|
||||||
{
|
{
|
||||||
if (out === undefined) { out = new Vector2(); }
|
if (out === undefined) { out = new Vector2(); }
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @method Phaser.Curves.Path#getLength
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @return {number} [description]
|
||||||
|
*/
|
||||||
var GetLength = function ()
|
var GetLength = function ()
|
||||||
{
|
{
|
||||||
var lens = this.getCurveLengths();
|
var lens = this.getCurveLengths();
|
||||||
|
|
|
@ -9,6 +9,17 @@ var Vector2 = require('../../../math/Vector2');
|
||||||
// 3. Get t for the curve
|
// 3. Get t for the curve
|
||||||
// 4. Return curve.getPointAt(t')
|
// 4. Return curve.getPointAt(t')
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @method Phaser.Curves.Path#getPoint
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @param {number} t - [description]
|
||||||
|
* @param {Phaser.Math.Vector2} [out] - [description]
|
||||||
|
*
|
||||||
|
* @return {Phaser.Math.Vector2|null} [description]
|
||||||
|
*/
|
||||||
var GetPoint = function (t, out)
|
var GetPoint = function (t, out)
|
||||||
{
|
{
|
||||||
if (out === undefined) { out = new Vector2(); }
|
if (out === undefined) { out = new Vector2(); }
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @method Phaser.Curves.Path#getPoints
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @param {integer} [divisions=12] - [description]
|
||||||
|
*
|
||||||
|
* @return {Phaser.Math.Vector2[]} [description]
|
||||||
|
*/
|
||||||
var GetPoints = function (divisions)
|
var GetPoints = function (divisions)
|
||||||
{
|
{
|
||||||
if (divisions === undefined) { divisions = 12; }
|
if (divisions === undefined) { divisions = 12; }
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @method Phaser.Curves.Path#getSpacedPoints
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @param {integer} [divisions=40] - [description]
|
||||||
|
*
|
||||||
|
* @return {Phaser.Math.Vector2[]} [description]
|
||||||
|
*/
|
||||||
var GetSpacedPoints = function (divisions)
|
var GetSpacedPoints = function (divisions)
|
||||||
{
|
{
|
||||||
if (divisions === undefined) { divisions = 40; }
|
if (divisions === undefined) { divisions = 40; }
|
||||||
|
|
|
@ -1,5 +1,15 @@
|
||||||
var Vector2 = require('../../../math/Vector2');
|
var Vector2 = require('../../../math/Vector2');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @method Phaser.Curves.Path#getStartPoint
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @param {Phaser.Math.Vector2} [out] - [description]
|
||||||
|
*
|
||||||
|
* @return {Phaser.Math.Vector2} [description]
|
||||||
|
*/
|
||||||
var GetStartPoint = function (out)
|
var GetStartPoint = function (out)
|
||||||
{
|
{
|
||||||
if (out === undefined) { out = new Vector2(); }
|
if (out === undefined) { out = new Vector2(); }
|
||||||
|
|
|
@ -2,6 +2,18 @@ var LineCurve = require('../../line/LineCurve');
|
||||||
var Vector2 = require('../../../math/Vector2');
|
var Vector2 = require('../../../math/Vector2');
|
||||||
|
|
||||||
// Creates a line curve from the previous end point to x/y
|
// Creates a line curve from the previous end point to x/y
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @method Phaser.Curves.Path#lineTo
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @param {number|Phaser.Math.Vector2} x - [description]
|
||||||
|
* @param {number} [y] - [description]
|
||||||
|
*
|
||||||
|
* @return {Phaser.Curves.Path} [description]
|
||||||
|
*/
|
||||||
var LineTo = function (x, y)
|
var LineTo = function (x, y)
|
||||||
{
|
{
|
||||||
if (x instanceof Vector2)
|
if (x instanceof Vector2)
|
||||||
|
|
|
@ -1,8 +1,19 @@
|
||||||
var MovePathTo = require('../MoveTo');
|
var MovePathTo = require('../MoveTo');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @method Phaser.Curves.Path#moveTo
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @param {number} x - [description]
|
||||||
|
* @param {number} y - [description]
|
||||||
|
*
|
||||||
|
* @return {Phaser.Curves.Path} [description]
|
||||||
|
*/
|
||||||
var MoveTo = function (x, y)
|
var MoveTo = function (x, y)
|
||||||
{
|
{
|
||||||
this.add(new MovePathTo(x, y));
|
return this.add(new MovePathTo(x, y));
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = MoveTo;
|
module.exports = MoveTo;
|
||||||
|
|
|
@ -1,6 +1,17 @@
|
||||||
var SplineCurve = require('../../spline/SplineCurve');
|
var SplineCurve = require('../../spline/SplineCurve');
|
||||||
|
|
||||||
// Creates a spline curve starting at the previous end point, using the given parameters
|
// Creates a spline curve starting at the previous end point, using the given parameters
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @method Phaser.Curves.Path#splineTo
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @param {[type]} points - [description]
|
||||||
|
*
|
||||||
|
* @return {Phaser.Curves.Path} [description]
|
||||||
|
*/
|
||||||
var SplineTo = function (points)
|
var SplineTo = function (points)
|
||||||
{
|
{
|
||||||
points.unshift(this.getEndPoint());
|
points.unshift(this.getEndPoint());
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @method Phaser.Curves.Path#toJSON
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @return {object} [description]
|
||||||
|
*/
|
||||||
var ToJSON = function ()
|
var ToJSON = function ()
|
||||||
{
|
{
|
||||||
var out = [];
|
var out = [];
|
||||||
|
|
|
@ -1,4 +1,11 @@
|
||||||
// cacheLengths must be recalculated.
|
// cacheLengths must be recalculated.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [description]
|
||||||
|
*
|
||||||
|
* @method Phaser.Curves.Path#updateArcLengths
|
||||||
|
* @since 3.0.0
|
||||||
|
*/
|
||||||
var UpdateArcLengths = function ()
|
var UpdateArcLengths = function ()
|
||||||
{
|
{
|
||||||
this.cacheLengths = [];
|
this.cacheLengths = [];
|
||||||
|
|
Loading…
Reference in a new issue