mirror of
https://github.com/photonstorm/phaser
synced 2024-11-24 13:43:26 +00:00
Merge branch 'master' of https://github.com/photonstorm/phaser
This commit is contained in:
commit
f8ca5e1f6f
2 changed files with 58 additions and 45 deletions
|
@ -27,7 +27,7 @@ var Wrap = require('../../math/Wrap');
|
||||||
*
|
*
|
||||||
* @param {Phaser.GameObjects.Particles.Particle} particle - The particle.
|
* @param {Phaser.GameObjects.Particles.Particle} particle - The particle.
|
||||||
* @param {string} key - The name of the property.
|
* @param {string} key - The name of the property.
|
||||||
* @param {float} t - The normalized lifetime of the particle, between 0 (start) and 1 (end).
|
* @param {number} t - The normalized lifetime of the particle, between 0 (start) and 1 (end).
|
||||||
* @param {number} value - The current value of the property.
|
* @param {number} value - The current value of the property.
|
||||||
*
|
*
|
||||||
* @return {number} The new value of the property.
|
* @return {number} The new value of the property.
|
||||||
|
@ -37,23 +37,23 @@ var Wrap = require('../../math/Wrap');
|
||||||
* Defines an operation yielding a random value within a range.
|
* Defines an operation yielding a random value within a range.
|
||||||
* @typedef {object} EmitterOpRandomConfig
|
* @typedef {object} EmitterOpRandomConfig
|
||||||
*
|
*
|
||||||
* @property {float[]} random - The minimum and maximum values, as [min, max].
|
* @property {number[]} random - The minimum and maximum values, as [min, max].
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines an operation yielding a random value within a range.
|
* Defines an operation yielding a random value within a range.
|
||||||
* @typedef {object} EmitterOpRandomMinMaxConfig
|
* @typedef {object} EmitterOpRandomMinMaxConfig
|
||||||
*
|
*
|
||||||
* @property {float} min - The minimum value.
|
* @property {number} min - The minimum value.
|
||||||
* @property {float} max - The maximum value.
|
* @property {number} max - The maximum value.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines an operation yielding a random value within a range.
|
* Defines an operation yielding a random value within a range.
|
||||||
* @typedef {object} EmitterOpRandomStartEndConfig
|
* @typedef {object} EmitterOpRandomStartEndConfig
|
||||||
*
|
*
|
||||||
* @property {float} start - The starting value.
|
* @property {number} start - The starting value.
|
||||||
* @property {float} end - The ending value.
|
* @property {number} end - The ending value.
|
||||||
* @property {boolean} random - If false, this becomes {@link EmitterOpEaseConfig}.
|
* @property {boolean} random - If false, this becomes {@link EmitterOpEaseConfig}.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -61,8 +61,8 @@ var Wrap = require('../../math/Wrap');
|
||||||
* Defines an operation yielding a value incremented continuously across a range.
|
* Defines an operation yielding a value incremented continuously across a range.
|
||||||
* @typedef {object} EmitterOpEaseConfig
|
* @typedef {object} EmitterOpEaseConfig
|
||||||
*
|
*
|
||||||
* @property {float} start - The starting value.
|
* @property {number} start - The starting value.
|
||||||
* @property {float} end - The ending value.
|
* @property {number} end - The ending value.
|
||||||
* @property {string} [ease='Linear'] - The name of the easing function.
|
* @property {string} [ease='Linear'] - The name of the easing function.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -90,16 +90,18 @@ var Wrap = require('../../math/Wrap');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @classdesc
|
* @classdesc
|
||||||
* [description]
|
* A Particle Emitter property.
|
||||||
|
*
|
||||||
|
* Facilitates changing Particle properties as they are emitted and throughout their lifetime.
|
||||||
*
|
*
|
||||||
* @class EmitterOp
|
* @class EmitterOp
|
||||||
* @memberOf Phaser.GameObjects.Particles
|
* @memberOf Phaser.GameObjects.Particles
|
||||||
* @constructor
|
* @constructor
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {object} config - [description]
|
* @param {ParticleEmitterConfig} config - Settings for the Particle Emitter that owns this property.
|
||||||
* @param {string} key - [description]
|
* @param {string} key - The key of the Particle Emitter property.
|
||||||
* @param {number} defaultValue - [description]
|
* @param {number} defaultValue - The default value of the Particle Emitter property.
|
||||||
* @param {boolean} [emitOnly=false] - [description]
|
* @param {boolean} [emitOnly=false] - [description]
|
||||||
*/
|
*/
|
||||||
var EmitterOp = new Class({
|
var EmitterOp = new Class({
|
||||||
|
@ -114,7 +116,7 @@ var EmitterOp = new Class({
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* The key of this property.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Particles.EmitterOp#propertyKey
|
* @name Phaser.GameObjects.Particles.EmitterOp#propertyKey
|
||||||
* @type {string}
|
* @type {string}
|
||||||
|
@ -123,7 +125,7 @@ var EmitterOp = new Class({
|
||||||
this.propertyKey = key;
|
this.propertyKey = key;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* The value of this property.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Particles.EmitterOp#propertyValue
|
* @name Phaser.GameObjects.Particles.EmitterOp#propertyValue
|
||||||
* @type {number}
|
* @type {number}
|
||||||
|
@ -132,7 +134,7 @@ var EmitterOp = new Class({
|
||||||
this.propertyValue = defaultValue;
|
this.propertyValue = defaultValue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* The default value of this property.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Particles.EmitterOp#defaultValue
|
* @name Phaser.GameObjects.Particles.EmitterOp#defaultValue
|
||||||
* @type {number}
|
* @type {number}
|
||||||
|
@ -141,7 +143,8 @@ var EmitterOp = new Class({
|
||||||
this.defaultValue = defaultValue;
|
this.defaultValue = defaultValue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* The number of steps for stepped easing between {@link Phaser.GameObjects.Particles.EmitterOp#start} and
|
||||||
|
* {@link Phaser.GameObjects.Particles.EmitterOp#end} values, per emit.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Particles.EmitterOp#steps
|
* @name Phaser.GameObjects.Particles.EmitterOp#steps
|
||||||
* @type {number}
|
* @type {number}
|
||||||
|
@ -151,7 +154,7 @@ var EmitterOp = new Class({
|
||||||
this.steps = 0;
|
this.steps = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* The step counter for stepped easing, per emit.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Particles.EmitterOp#counter
|
* @name Phaser.GameObjects.Particles.EmitterOp#counter
|
||||||
* @type {number}
|
* @type {number}
|
||||||
|
@ -161,7 +164,7 @@ var EmitterOp = new Class({
|
||||||
this.counter = 0;
|
this.counter = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* The start value for this property to ease between.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Particles.EmitterOp#start
|
* @name Phaser.GameObjects.Particles.EmitterOp#start
|
||||||
* @type {number}
|
* @type {number}
|
||||||
|
@ -171,7 +174,7 @@ var EmitterOp = new Class({
|
||||||
this.start = 0;
|
this.start = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* The end value for this property to ease between.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Particles.EmitterOp#end
|
* @name Phaser.GameObjects.Particles.EmitterOp#end
|
||||||
* @type {number}
|
* @type {number}
|
||||||
|
@ -181,7 +184,7 @@ var EmitterOp = new Class({
|
||||||
this.end = 0;
|
this.end = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* The easing function to use for interpolating this property.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Particles.EmitterOp#ease
|
* @name Phaser.GameObjects.Particles.EmitterOp#ease
|
||||||
* @type {?function}
|
* @type {?function}
|
||||||
|
@ -190,7 +193,13 @@ var EmitterOp = new Class({
|
||||||
this.ease;
|
this.ease;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Whether this property can only be modified when a Particle is emitted.
|
||||||
|
*
|
||||||
|
* Set to `true` to allow only {@link Phaser.GameObjects.Particles.EmitterOp#onEmit} callbacks to be set and
|
||||||
|
* affect this property.
|
||||||
|
*
|
||||||
|
* Set to `false` to allow both {@link Phaser.GameObjects.Particles.EmitterOp#onEmit} and
|
||||||
|
* {@link Phaser.GameObjects.Particles.EmitterOp#onUpdate} callbacks to be set and affect this property.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Particles.EmitterOp#emitOnly
|
* @name Phaser.GameObjects.Particles.EmitterOp#emitOnly
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
|
@ -199,7 +208,7 @@ var EmitterOp = new Class({
|
||||||
this.emitOnly = emitOnly;
|
this.emitOnly = emitOnly;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* The callback to run for Particles when they are emitted from the Particle Emitter.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Particles.EmitterOp#onEmit
|
* @name Phaser.GameObjects.Particles.EmitterOp#onEmit
|
||||||
* @type {EmitterOpOnEmitCallback}
|
* @type {EmitterOpOnEmitCallback}
|
||||||
|
@ -208,7 +217,7 @@ var EmitterOp = new Class({
|
||||||
this.onEmit = this.defaultEmit;
|
this.onEmit = this.defaultEmit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* The callback to run for Particles when they are updated.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Particles.EmitterOp#onUpdate
|
* @name Phaser.GameObjects.Particles.EmitterOp#onUpdate
|
||||||
* @type {EmitterOpOnUpdateCallback}
|
* @type {EmitterOpOnUpdateCallback}
|
||||||
|
@ -220,13 +229,15 @@ var EmitterOp = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Load the property from a Particle Emitter configuration object.
|
||||||
|
*
|
||||||
|
* Optionally accepts a new property key to use, replacing the current one.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Particles.EmitterOp#loadConfig
|
* @method Phaser.GameObjects.Particles.EmitterOp#loadConfig
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {object} [config] - [description]
|
* @param {ParticleEmitterConfig} [config] - Settings for the Particle Emitter that owns this property.
|
||||||
* @param {string} [newKey] - [description]
|
* @param {string} [newKey] - The new key to use for this property, if any.
|
||||||
*/
|
*/
|
||||||
loadConfig: function (config, newKey)
|
loadConfig: function (config, newKey)
|
||||||
{
|
{
|
||||||
|
@ -256,12 +267,12 @@ var EmitterOp = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Build a JSON representation of this Particle Emitter property.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Particles.EmitterOp#toJSON
|
* @method Phaser.GameObjects.Particles.EmitterOp#toJSON
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @return {object} [description]
|
* @return {object} A JSON representation of this Particle Emitter property.
|
||||||
*/
|
*/
|
||||||
toJSON: function ()
|
toJSON: function ()
|
||||||
{
|
{
|
||||||
|
@ -286,7 +297,9 @@ var EmitterOp = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Update the {@link Phaser.GameObjects.Particles.EmitterOp#onEmit} and
|
||||||
|
* {@link Phaser.GameObjects.Particles.EmitterOp#onUpdate} callbacks based on the type of the current
|
||||||
|
* {@link Phaser.GameObjects.Particles.EmitterOp#propertyValue}.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Particles.EmitterOp#setMethods
|
* @method Phaser.GameObjects.Particles.EmitterOp#setMethods
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
|
@ -429,15 +442,15 @@ var EmitterOp = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Check whether an object has the given property.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Particles.EmitterOp#has
|
* @method Phaser.GameObjects.Particles.EmitterOp#has
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {object} object - [description]
|
* @param {object} object - The object to check.
|
||||||
* @param {string} key - [description]
|
* @param {string} key - The key of the property to look for in the object.
|
||||||
*
|
*
|
||||||
* @return {boolean} [description]
|
* @return {boolean} `true` if the property exists in the object, `false` otherwise.
|
||||||
*/
|
*/
|
||||||
has: function (object, key)
|
has: function (object, key)
|
||||||
{
|
{
|
||||||
|
@ -445,16 +458,16 @@ var EmitterOp = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Check whether an object has both of the given properties.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Particles.EmitterOp#hasBoth
|
* @method Phaser.GameObjects.Particles.EmitterOp#hasBoth
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {object} object - [description]
|
* @param {object} object - The object to check.
|
||||||
* @param {string} key1 - [description]
|
* @param {string} key1 - The key of the first property to check the object for.
|
||||||
* @param {string} key2 - [description]
|
* @param {string} key2 - The key of the second property to check the object for.
|
||||||
*
|
*
|
||||||
* @return {boolean} [description]
|
* @return {boolean} `true` if both properties exist in the object, `false` otherwise.
|
||||||
*/
|
*/
|
||||||
hasBoth: function (object, key1, key2)
|
hasBoth: function (object, key1, key2)
|
||||||
{
|
{
|
||||||
|
@ -462,16 +475,16 @@ var EmitterOp = new Class({
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [description]
|
* Check whether an object has at least one of the given properties.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.Particles.EmitterOp#hasEither
|
* @method Phaser.GameObjects.Particles.EmitterOp#hasEither
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {object} object - [description]
|
* @param {object} object - The object to check.
|
||||||
* @param {string} key1 - [description]
|
* @param {string} key1 - The key of the first property to check the object for.
|
||||||
* @param {string} key2 - [description]
|
* @param {string} key2 - The key of the second property to check the object for.
|
||||||
*
|
*
|
||||||
* @return {boolean} [description]
|
* @return {boolean} `true` if at least one of the properties exists in the object, `false` if neither exist.
|
||||||
*/
|
*/
|
||||||
hasEither: function (object, key1, key2)
|
hasEither: function (object, key1, key2)
|
||||||
{
|
{
|
||||||
|
@ -503,7 +516,7 @@ var EmitterOp = new Class({
|
||||||
*
|
*
|
||||||
* @param {Phaser.GameObjects.Particles.Particle} particle - [description]
|
* @param {Phaser.GameObjects.Particles.Particle} particle - [description]
|
||||||
* @param {string} key - [description]
|
* @param {string} key - [description]
|
||||||
* @param {float} t - The T value (between 0 and 1)
|
* @param {number} t - The T value (between 0 and 1)
|
||||||
* @param {number} value - [description]
|
* @param {number} value - [description]
|
||||||
*
|
*
|
||||||
* @return {number} [description]
|
* @return {number} [description]
|
||||||
|
|
|
@ -356,7 +356,7 @@ var ParticleEmitter = new Class({
|
||||||
this.gravityY = 0;
|
this.gravityY = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether accelerationX and accelerationY are nonzero. Set automatically during configuration.
|
* Whether accelerationX and accelerationY are non-zero. Set automatically during configuration.
|
||||||
*
|
*
|
||||||
* @name Phaser.GameObjects.Particles.ParticleEmitter#acceleration
|
* @name Phaser.GameObjects.Particles.ParticleEmitter#acceleration
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
|
|
Loading…
Reference in a new issue