2017-10-13 15:39:41 +00:00
|
|
|
// Based on the three.js Curve classes created by [zz85](http://www.lab4games.net/zz85/blog)
|
|
|
|
|
|
|
|
var Class = require('../../utils/Class');
|
|
|
|
var Vector2 = require('../../math/Vector2');
|
|
|
|
|
|
|
|
// Our Base Curve which all other curves extend
|
|
|
|
|
|
|
|
var Curve = new Class({
|
|
|
|
|
|
|
|
initialize:
|
|
|
|
|
2017-10-13 16:08:19 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @class Curve
|
|
|
|
* @memberOf Phaser.Curves
|
|
|
|
* @constructor
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {string} type - [description]
|
|
|
|
*/
|
2017-10-13 15:39:41 +00:00
|
|
|
function Curve (type)
|
|
|
|
{
|
2017-10-13 16:08:19 +00:00
|
|
|
/**
|
|
|
|
* String based identifier
|
|
|
|
*
|
|
|
|
* @property {string} type
|
|
|
|
*/
|
2017-10-13 15:39:41 +00:00
|
|
|
this.type = type;
|
|
|
|
|
2017-10-13 16:08:19 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @property {integer} defaultDivisions
|
|
|
|
* @default 5
|
|
|
|
*/
|
2017-10-13 15:39:41 +00:00
|
|
|
this.defaultDivisions = 5;
|
|
|
|
|
2017-10-13 16:08:19 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @property {integer} arcLengthDivisions
|
|
|
|
* @default 100
|
|
|
|
*/
|
2017-10-13 15:39:41 +00:00
|
|
|
this.arcLengthDivisions = 100;
|
|
|
|
|
2017-10-13 16:08:19 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @property {array} cacheArcLengths
|
|
|
|
* @default []
|
|
|
|
*/
|
2017-10-13 15:39:41 +00:00
|
|
|
this.cacheArcLengths = [];
|
|
|
|
|
2017-10-13 16:08:19 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @property {boolean} needsUpdate
|
|
|
|
* @default true
|
|
|
|
*/
|
2017-10-13 15:39:41 +00:00
|
|
|
this.needsUpdate = true;
|
|
|
|
|
2017-10-13 16:08:19 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @property {boolean} active
|
|
|
|
* @default true
|
|
|
|
*/
|
2017-10-13 15:39:41 +00:00
|
|
|
this.active = true;
|
|
|
|
|
2017-10-13 16:08:19 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @property {Phaser.Math.Vector2} _tmpVec2A
|
|
|
|
* @private
|
|
|
|
*/
|
2017-10-13 15:39:41 +00:00
|
|
|
this._tmpVec2A = new Vector2();
|
2017-10-13 16:08:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @property {Phaser.Math.Vector2} _tmpVec2B
|
|
|
|
* @private
|
|
|
|
*/
|
2017-10-13 15:39:41 +00:00
|
|
|
this._tmpVec2B = new Vector2();
|
|
|
|
},
|
|
|
|
|
|
|
|
draw: require('./inc/Draw'),
|
|
|
|
getBounds: require('./inc/GetBounds'),
|
|
|
|
getDistancePoints: require('./inc/GetDistancePoints'),
|
|
|
|
getEndPoint: require('./inc/GetEndPoint'),
|
|
|
|
getLength: require('./inc/GetLength'),
|
|
|
|
getLengths: require('./inc/GetLengths'),
|
|
|
|
getPointAt: require('./inc/GetPointAt'),
|
|
|
|
getPoints: require('./inc/GetPoints'),
|
2017-10-18 12:45:34 +00:00
|
|
|
getRandomPoint: require('./inc/GetRandomPoint'),
|
2017-10-13 15:39:41 +00:00
|
|
|
getSpacedPoints: require('./inc/GetSpacedPoints'),
|
|
|
|
getStartPoint: require('./inc/GetStartPoint'),
|
|
|
|
getTangent: require('./inc/GetTangent'),
|
|
|
|
getTangentAt: require('./inc/GetTangentAt'),
|
|
|
|
getTFromDistance: require('./inc/GetTFromDistance'),
|
|
|
|
getUtoTmapping: require('./inc/GetUToTMapping'),
|
|
|
|
updateArcLengths: require('./inc/UpdateArcLengths')
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
module.exports = Curve;
|