phaser/src/curves/curve/Curve.js

108 lines
2.5 KiB
JavaScript
Raw Normal View History

// 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]
*/
function Curve (type)
{
2017-10-13 16:08:19 +00:00
/**
* String based identifier
*
* @property {string} type
*/
this.type = type;
2017-10-13 16:08:19 +00:00
/**
* [description]
*
* @property {integer} defaultDivisions
* @default 5
*/
this.defaultDivisions = 5;
2017-10-13 16:08:19 +00:00
/**
* [description]
*
* @property {integer} arcLengthDivisions
* @default 100
*/
this.arcLengthDivisions = 100;
2017-10-13 16:08:19 +00:00
/**
* [description]
*
* @property {array} cacheArcLengths
* @default []
*/
this.cacheArcLengths = [];
2017-10-13 16:08:19 +00:00
/**
* [description]
*
* @property {boolean} needsUpdate
* @default true
*/
this.needsUpdate = true;
2017-10-13 16:08:19 +00:00
/**
* [description]
*
* @property {boolean} active
* @default true
*/
this.active = true;
2017-10-13 16:08:19 +00:00
/**
* [description]
*
* @property {Phaser.Math.Vector2} _tmpVec2A
* @private
*/
this._tmpVec2A = new Vector2();
2017-10-13 16:08:19 +00:00
/**
* [description]
*
* @property {Phaser.Math.Vector2} _tmpVec2B
* @private
*/
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'),
getRandomPoint: require('./inc/GetRandomPoint'),
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;