diff --git a/src/gameobjects/components/GetBounds.js b/src/gameobjects/components/GetBounds.js index 84c970c19..ba2a0224b 100644 --- a/src/gameobjects/components/GetBounds.js +++ b/src/gameobjects/components/GetBounds.js @@ -196,7 +196,7 @@ var GetBounds = { * @method Phaser.GameObjects.Components.GetBounds#getBounds * @since 3.0.0 * - * @generic {Phaser.Math.Vector2} O - [output,$return] + * @generic {Phaser.Geom.Rectangle} O - [output,$return] * * @param {(Phaser.Geom.Rectangle|object)} [output] - An object to store the values in. If not provided a new Rectangle will be created. * diff --git a/src/gameobjects/particles/EmitterOp.js b/src/gameobjects/particles/EmitterOp.js index 805325248..0a7588741 100644 --- a/src/gameobjects/particles/EmitterOp.js +++ b/src/gameobjects/particles/EmitterOp.js @@ -11,26 +11,81 @@ var GetFastValue = require('../../utils/object/GetFastValue'); var Wrap = require('../../math/Wrap'); /** - * The returned value sets what the property will be at the START of the particles life, on emit. + * The returned value sets what the property will be at the START of the particle's life, on emit. * @callback EmitterOpOnEmitCallback * - * @param {Phaser.GameObjects.Particles.Particle} particle - [description] - * @param {string} key - [description] - * @param {number} value - [description] + * @param {Phaser.GameObjects.Particles.Particle} particle - The particle. + * @param {string} key - The name of the property. + * @param {number} value - The current value of the property. * - * @return {number} [description] + * @return {number} The new value of the property. */ /** - * The returned value updates the property for the duration of the particles life. + * The returned value updates the property for the duration of the particle's life. * @callback EmitterOpOnUpdateCallback * - * @param {Phaser.GameObjects.Particles.Particle} particle - [description] - * @param {string} key - [description] - * @param {float} t - The T value (between 0 and 1) - * @param {number} value - [description] + * @param {Phaser.GameObjects.Particles.Particle} particle - The particle. + * @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} value - The current value of the property. * - * @return {number} [description] + * @return {number} The new value of the property. + */ + +/** + * Defines an operation yielding a random value within a range. + * @typedef {object} EmitterOpRandomConfig + * + * @property {float[]} random - The minimum and maximum values, as [min, max]. + */ + +/** + * Defines an operation yielding a random value within a range. + * @typedef {object} EmitterOpRandomMinMaxConfig + * + * @property {float} min - The minimum value. + * @property {float} max - The maximum value. + */ + +/** + * Defines an operation yielding a random value within a range. + * @typedef {object} EmitterOpRandomStartEndConfig + * + * @property {float} start - The starting value. + * @property {float} end - The ending value. + * @property {boolean} random - If false, this becomes {@link EmitterOpEaseConfig}. + */ + +/** + * Defines an operation yielding a value incremented continuously across a range. + * @typedef {object} EmitterOpEaseConfig + * + * @property {float} start - The starting value. + * @property {float} end - The ending value. + * @property {string} [ease='Linear'] - The name of the easing function. + */ + +/** + * Defines an operation yielding a value incremented by steps across a range. + * @typedef {object} EmitterOpSteppedConfig + * + * @property {number} start - The starting value. + * @property {number} end - The ending value. + * @property {number} steps - The number of steps between start and end. + */ + +/** + * @typedef {object} EmitterOpCustomEmitConfig + * + * @property {EmitterOpOnEmitCallback} onEmit - [description] + */ + +/** + * @typedef {object} EmitterOpCustomUpdateConfig + * + * @property {EmitterOpOnEmitCallback} [onEmit] - [description] + * @property {EmitterOpOnUpdateCallback} onUpdate - [description] */ /** @@ -247,7 +302,7 @@ var EmitterOp = new Class({ // x: 400 this.onEmit = this.staticValueEmit; - this.onUpdate = this.staticValueUpdate; + this.onUpdate = this.staticValueUpdate; // How? } else if (Array.isArray(value)) { @@ -327,6 +382,7 @@ var EmitterOp = new Class({ // x: { start: 100, end: 400, [ ease: 'Linear' ] } + var easeType = this.has(value, 'ease') ? value.ease : 'Linear'; this.ease = GetEaseFunction(easeType); @@ -336,6 +392,9 @@ var EmitterOp = new Class({ this.onEmit = this.easedValueEmit; } + // BUG: alpha, rotate, scaleX, scaleY, or tint are eased here if {min, max} is given. + // Probably this branch should exclude isRandom entirely. + this.onUpdate = this.easeValueUpdate; } } diff --git a/src/gameobjects/particles/Particle.js b/src/gameobjects/particles/Particle.js index 2667a5168..fb7a3dd0f 100644 --- a/src/gameobjects/particles/Particle.js +++ b/src/gameobjects/particles/Particle.js @@ -10,7 +10,8 @@ var DistanceBetween = require('../../math/distance/DistanceBetween'); /** * @classdesc - * [description] + * A Particle is a simple Game Object controlled by a Particle Emitter and Manager, and rendered by the Manager. + * It uses its own lightweight physics system, and can interact only with its Emitter's bounds and zones. * * @class Particle * @memberOf Phaser.GameObjects.Particles @@ -37,7 +38,7 @@ var Particle = new Class({ this.emitter = emitter; /** - * [description] + * The texture frame used to render this Particle. * * @name Phaser.GameObjects.Particles.Particle#frame * @type {Phaser.Textures.Frame} @@ -47,7 +48,7 @@ var Particle = new Class({ this.frame = null; /** - * [description] + * The position of this Particle within its Emitter's particle pool. * * @name Phaser.GameObjects.Particles.Particle#index * @type {number} @@ -207,7 +208,7 @@ var Particle = new Class({ this.tint = 0xffffffff; /** - * [description] + * The full color of this Particle, computed from its alpha and tint. * * @name Phaser.GameObjects.Particles.Particle#color * @type {number} @@ -246,7 +247,7 @@ var Particle = new Class({ this.delayCurrent = 0; /** - * The normalized lifespan T value. + * The normalized lifespan T value, where 0 is the start and 1 is the end. * * @name Phaser.GameObjects.Particles.Particle#lifeT * @type {float} @@ -405,7 +406,7 @@ var Particle = new Class({ * @param {Phaser.GameObjects.Particles.ParticleEmitter} emitter - The Emitter that is updating this Particle. * @param {number} delta - The delta time in ms. * @param {float} step - The delta value divided by 1000. - * @param {array} processors - [description] + * @param {array} processors - Particle processors (gravity wells). */ computeVelocity: function (emitter, delta, step, processors) { diff --git a/src/gameobjects/particles/ParticleEmitter.js b/src/gameobjects/particles/ParticleEmitter.js index 987119edb..f8e0cfbbb 100644 --- a/src/gameobjects/particles/ParticleEmitter.js +++ b/src/gameobjects/particles/ParticleEmitter.js @@ -24,19 +24,132 @@ var Wrap = require('../../math/Wrap'); /** * @callback ParticleEmitterCallback * - * @param {Phaser.GameObjects.Particles.Particle} particle - [description] - * @param {Phaser.GameObjects.Particles.ParticleEmitter} emitter - [description] + * @param {Phaser.GameObjects.Particles.Particle} particle - The particle associated with the call. + * @param {Phaser.GameObjects.Particles.ParticleEmitter} emitter - This particle emitter associated with the call. */ /** * @callback ParticleDeathCallback * - * @param {Phaser.GameObjects.Particles.Particle} particle - [description] + * @param {Phaser.GameObjects.Particles.Particle} particle - The particle that died. +*/ + +/** + * @typedef {object} ParticleEmitterBounds + * + * @property {float} x - The left edge of the rectangle. + * @property {float} y - The top edge of the rectangle. + * @property {float} width - The width of the rectangle. + * @property {float} height - The height of the rectangle. + * + * @see Phaser.GameObjects.Particles.ParticleEmitter#setBounds + */ + +/** + * @typedef {object} ParticleEmitterBoundsAlt + * + * @property {float} x - The left edge of the rectangle. + * @property {float} y - The top edge of the rectangle. + * @property {float} w - The width of the rectangle. + * @property {float} h - The height of the rectangle. + * + * @see Phaser.GameObjects.Particles.ParticleEmitter#setBounds + */ + +/** + * @typedef {object} ParticleEmitterDeathZoneConfig + * + * @property {DeathZoneSource} source - A shape representing the zone. See {@link Phaser.GameObjects.Particles.Zones.DeathZone#source}. + * @property {string} [type='onEnter'] - 'onEnter' or 'onLeave'. + */ + +/** + * @typedef {object} ParticleEmitterEdgeZoneConfig + * + * @property {EdgeZoneSource|RandomZoneSource} source - A shape representing the zone. See {@link Phaser.GameObjects.Particles.Zones.EdgeZone#source}. + * @property {string} type - 'edge'. + * @property {integer} quantity - The number of particles to place on the source edge. Set to 0 to use `stepRate` instead. + * @property {float} [stepRate] - The distance between each particle. When set, `quantity` is implied and should be set to 0. + * @property {boolean} [yoyo=false] - Whether particles are placed from start to end and then end to start. + * @property {boolean} [seamless=true] - Whether one endpoint will be removed if it's identical to the other. + */ + +/** + * @typedef {object} ParticleEmitterRandomZoneConfig + * + * @property {EdgeZoneSource|RandomZoneSource} source - A shape representing the zone. See {@link Phaser.GameObjects.Particles.Zones.RandomZone#source}. + * @property {string} [type] - 'random'. + */ + +/** + * @typedef {object} ParticleEmitterConfig + * + * @property {boolean} [active] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#active}. + * @property {integer} [blendMode] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#blendMode}. + * @property {*} [callbackScope] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#deathCallbackScope} and {@link Phaser.GameObjects.Particles.ParticleEmitter#emitCallbackScope}. + * @property {boolean} [collideBottom] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#collideBottom}. + * @property {boolean} [collideLeft] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#collideLeft}. + * @property {boolean} [collideRight] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#collideRight}. + * @property {boolean} [collideTop] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#collideTop}. + * @property {boolean} [deathCallback] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#deathCallback}. + * @property {*} [deathCallbackScope] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#deathCallbackScope}. + * @property {function} [emitCallback] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#emitCallback}. + * @property {*} [emitCallbackScope] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#emitCallbackScope}. + * @property {Phaser.GameObjects.GameObject} [follow] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#follow}. + * @property {float} [frequency] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#frequency}. + * @property {float} [gravityX] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#gravityX}. + * @property {float} [gravityY] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#gravityY}. + * @property {integer} [maxParticles] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#maxParticles}. + * @property {string} [name] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#name}. + * @property {boolean} [on] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#on}. + * @property {boolean} [particleBringToTop] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#particleBringToTop}. + * @property {Phaser.GameObjects.Particles.Particle} [particleClass] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#particleClass}. + * @property {boolean} [radial] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#radial}. + * @property {float} [timeScale] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#timeScale}. + * @property {boolean} [trackVisible] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#trackVisible}. + * @property {boolean} [visible] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#visible}. + * @property {float|float[]|EmitterOpOnEmitCallback|object} [accelerationX] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#accelerationX} (emit only). + * @property {float|float[]|EmitterOpOnEmitCallback|object} [accelerationY] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#accelerationY} (emit only). + * @property {float|float[]|EmitterOpOnUpdateCallback|object} [alpha] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#alpha}. + * @property {float|float[]|EmitterOpOnEmitCallback|object} [angle] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#angle} (emit only) + * @property {float|float[]|EmitterOpOnEmitCallback|object} [bounce] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#bounce} (emit only). + * @property {float|float[]|EmitterOpOnEmitCallback|object} [delay] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#delay} (emit only). + * @property {float|float[]|EmitterOpOnEmitCallback|object} [lifespan] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#lifespan} (emit only). + * @property {float|float[]|EmitterOpOnEmitCallback|object} [maxVelocityX] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#maxVelocityX} (emit only). + * @property {float|float[]|EmitterOpOnEmitCallback|object} [maxVelocityY] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#maxVelocityY} (emit only). + * @property {float|float[]|EmitterOpOnEmitCallback|object} [moveToX] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#moveToX} (emit only). + * @property {float|float[]|EmitterOpOnEmitCallback|object} [moveToY] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#moveToY} (emit only). + * @property {float|float[]|EmitterOpOnEmitCallback|object} [quantity] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#quantity} (emit only). + * @property {float|float[]|EmitterOpOnUpdateCallback|object} [rotate] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#rotate}. + * @property {float|float[]|EmitterOpOnUpdateCallback|object} [scale] - As {@link Phaser.GameObjects.Particles.ParticleEmitter#setScale}. + * @property {float|float[]|EmitterOpOnUpdateCallback|object} [scaleX] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#scaleX}. + * @property {float|float[]|EmitterOpOnUpdateCallback|object} [scaleY] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#scaleY}. + * @property {float|float[]|EmitterOpOnEmitCallback|object} [speed] - As {@link Phaser.GameObjects.Particles.ParticleEmitter#setSpeed} (emit only). + * @property {float|float[]|EmitterOpOnEmitCallback|object} [speedX] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#speedX} (emit only). + * @property {float|float[]|EmitterOpOnEmitCallback|object} [speedY] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#speedY} (emit only). + * @property {float|float[]|EmitterOpOnEmitCallback|object} [tint] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#tint}. + * @property {float|float[]|EmitterOpOnEmitCallback|object} [x] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#x} (emit only). + * @property {float|float[]|EmitterOpOnEmitCallback|object} [y] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#y} (emit only). + * @property {object} [emitZone] - As {@link Phaser.GameObjects.Particles.ParticleEmitter#setEmitZone}. + * @property {ParticleEmitterBounds|ParticleEmitterBoundsAlt} [bounds] - As {@link Phaser.GameObjects.Particles.ParticleEmitter#setBounds}. + * @property {object} [followOffset] - Assigns to {@link Phaser.GameObjects.Particles.ParticleEmitter#followOffset}. + * @property {float} [followOffset.x] - x-coordinate of the offset. + * @property {float} [followOffset.y] - y-coordinate of the offset. + * @property {number|number[]|string|string[]|Phaser.Textures.Frame|Phaser.Textures.Frame[]|ParticleEmitterFrameConfig} [frames] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#frames}. + */ + +/** + * @typedef {object} ParticleEmitterFrameConfig + * + * @property {number|number[]|string|string[]|Phaser.Textures.Frame|Phaser.Textures.Frame[]} [frames] - One or more texture frames. + * @property {boolean} [cycle] - Whether texture frames will be assigned consecutively (true) or at random (false). + * @property {integer} [quantity] - The number of consecutive particles receiving each texture frame, when `cycle` is true. */ /** * @classdesc - * [description] + * A particle emitter represents a single particle stream. + * It controls a pool of {@link Phaser.GameObjects.Particles.Particle Particles} and is controlled by a {@link Phaser.GameObjects.Particles.ParticleEmitterManager Particle Emitter Manager}. * * @class ParticleEmitter * @memberOf Phaser.GameObjects.Particles @@ -49,7 +162,7 @@ var Wrap = require('../../math/Wrap'); * @extends Phaser.GameObjects.Components.Visible * * @param {Phaser.GameObjects.Particles.ParticleEmitterManager} manager - The Emitter Manager this Emitter belongs to. - * @param {object} config - [description] + * @param {ParticleEmitterConfig} config - Settings for this emitter. */ var ParticleEmitter = new Class({ @@ -74,7 +187,7 @@ var ParticleEmitter = new Class({ this.manager = manager; /** - * [description] + * The texture assigned to particles. * * @name Phaser.GameObjects.Particles.ParticleEmitter#texture * @type {Phaser.Textures.Texture} @@ -83,7 +196,7 @@ var ParticleEmitter = new Class({ this.texture = manager.texture; /** - * [description] + * The texture frames assigned to particles. * * @name Phaser.GameObjects.Particles.ParticleEmitter#frames * @type {Phaser.Textures.Frame[]} @@ -92,7 +205,7 @@ var ParticleEmitter = new Class({ this.frames = [ manager.defaultFrame ]; /** - * [description] + * The default texture frame assigned to particles. * * @name Phaser.GameObjects.Particles.ParticleEmitter#defaultFrame * @type {Phaser.Textures.Frame} @@ -101,7 +214,7 @@ var ParticleEmitter = new Class({ this.defaultFrame = manager.defaultFrame; /** - * [description] + * Names of simple configuration properties. * * @name Phaser.GameObjects.Particles.ParticleEmitter#configFastMap * @type {object} @@ -134,7 +247,7 @@ var ParticleEmitter = new Class({ ]; /** - * [description] + * Names of complex configuration properties. * * @name Phaser.GameObjects.Particles.ParticleEmitter#configOpMap * @type {object} @@ -163,7 +276,7 @@ var ParticleEmitter = new Class({ ]; /** - * The name of this Game Object. + * The name of this Particle Emitter. * * Empty by default and never populated by Phaser, this is left for developers to use. * @@ -179,62 +292,70 @@ var ParticleEmitter = new Class({ * * @name Phaser.GameObjects.Particles.ParticleEmitter#particleClass * @type {Phaser.GameObjects.Particles.Particle} + * @default Phaser.GameObjects.Particles.Particle * @since 3.0.0 */ this.particleClass = Particle; /** - * [description] + * The x-coordinate of the particle origin (where particles will be emitted). * * @name Phaser.GameObjects.Particles.ParticleEmitter#x - * @type {number} + * @type {Phaser.GameObjects.Particles.EmitterOp} + * @default 0 * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#setPosition */ this.x = new EmitterOp(config, 'x', 0); /** - * [description] + * The y-coordinate of the particle origin (where particles will be emitted). * * @name Phaser.GameObjects.Particles.ParticleEmitter#y - * @type {number} + * @type {Phaser.GameObjects.Particles.EmitterOp} + * @default 0 * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#setPosition */ this.y = new EmitterOp(config, 'y', 0); /** * A radial emitter will emit particles in all directions between angle min and max, - * using speed as the value. If set to false then this acts as a point Emitter. + * using {@link Phaser.GameObjects.Particles.ParticleEmitter#speed} as the value. If set to false then this acts as a point Emitter. * A point emitter will emit particles only in the direction derived from the speedX and speedY values. * * @name Phaser.GameObjects.Particles.ParticleEmitter#radial * @type {boolean} * @default true * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#setRadial */ this.radial = true; /** - * [description] + * Horizontal acceleration applied to emitted particles, in pixels per second squared. * * @name Phaser.GameObjects.Particles.ParticleEmitter#gravityX - * @type {number} + * @type {float} * @default 0 * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#setGravity */ this.gravityX = 0; /** - * [description] + * Vertical acceleration applied to emitted particles, in pixels per second squared. * * @name Phaser.GameObjects.Particles.ParticleEmitter#gravityY - * @type {number} + * @type {float} * @default 0 * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#setGravity */ this.gravityY = 0; /** - * [description] + * Whether accelerationX and accelerationY are nonzero. Set automatically during configuration. * * @name Phaser.GameObjects.Particles.ParticleEmitter#acceleration * @type {boolean} @@ -244,67 +365,69 @@ var ParticleEmitter = new Class({ this.acceleration = false; /** - * [description] + * Horizontal acceleration applied to emitted particles, in pixels per second squared. * * @name Phaser.GameObjects.Particles.ParticleEmitter#accelerationX - * @type {number} + * @type {Phaser.GameObjects.Particles.EmitterOp} * @default 0 * @since 3.0.0 */ this.accelerationX = new EmitterOp(config, 'accelerationX', 0, true); /** - * [description] + * Vertical acceleration applied to emitted particles, in pixels per second squared. * * @name Phaser.GameObjects.Particles.ParticleEmitter#accelerationY - * @type {number} + * @type {Phaser.GameObjects.Particles.EmitterOp} * @default 0 * @since 3.0.0 */ this.accelerationY = new EmitterOp(config, 'accelerationY', 0, true); /** - * [description] + * The maximum horizontal velocity of emitted particles, in pixels per second squared. * * @name Phaser.GameObjects.Particles.ParticleEmitter#maxVelocityX - * @type {number} + * @type {Phaser.GameObjects.Particles.EmitterOp} * @default 10000 * @since 3.0.0 */ this.maxVelocityX = new EmitterOp(config, 'maxVelocityX', 10000, true); /** - * [description] + * The maximum vertical velocity of emitted particles, in pixels per second squared. * * @name Phaser.GameObjects.Particles.ParticleEmitter#maxVelocityY - * @type {number} + * @type {Phaser.GameObjects.Particles.EmitterOp} * @default 10000 * @since 3.0.0 */ this.maxVelocityY = new EmitterOp(config, 'maxVelocityY', 10000, true); /** - * [description] + * The initial horizontal speed of emitted particles, in pixels per second. * * @name Phaser.GameObjects.Particles.ParticleEmitter#speedX - * @type {number} + * @type {Phaser.GameObjects.Particles.EmitterOp} * @default 0 * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#setSpeedX */ this.speedX = new EmitterOp(config, 'speedX', 0, true); /** - * [description] + * The initial vertical speed of emitted particles, in pixels per second. * * @name Phaser.GameObjects.Particles.ParticleEmitter#speedY - * @type {number} + * @type {Phaser.GameObjects.Particles.EmitterOp} * @default 0 * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#setSpeedY */ this.speedY = new EmitterOp(config, 'speedY', 0, true); /** - * [description] + * Whether moveToX and moveToY are nonzero. Set automatically during configuration. * * @name Phaser.GameObjects.Particles.ParticleEmitter#moveTo * @type {boolean} @@ -314,105 +437,114 @@ var ParticleEmitter = new Class({ this.moveTo = false; /** - * [description] + * The x-coordinate emitted particles move toward, when {@link Phaser.GameObjects.Particles.ParticleEmitter#moveTo} is true. * * @name Phaser.GameObjects.Particles.ParticleEmitter#moveToX - * @type {number} + * @type {Phaser.GameObjects.Particles.EmitterOp} * @default 0 * @since 3.0.0 */ this.moveToX = new EmitterOp(config, 'moveToX', 0, true); /** - * [description] + * The y-coordinate emitted particles move toward, when {@link Phaser.GameObjects.Particles.ParticleEmitter#moveTo} is true. * * @name Phaser.GameObjects.Particles.ParticleEmitter#moveToY - * @type {number} + * @type {Phaser.GameObjects.Particles.EmitterOp} * @default 0 * @since 3.0.0 */ this.moveToY = new EmitterOp(config, 'moveToY', 0, true); /** - * [description] + * Whether particles will rebound when they meet the emitter bounds. * * @name Phaser.GameObjects.Particles.ParticleEmitter#bounce - * @type {number} + * @type {Phaser.GameObjects.Particles.EmitterOp} * @default 0 * @since 3.0.0 */ this.bounce = new EmitterOp(config, 'bounce', 0, true); /** - * [description] + * The horizontal scale of emitted particles. * * @name Phaser.GameObjects.Particles.ParticleEmitter#scaleX - * @type {float} + * @type {Phaser.GameObjects.Particles.EmitterOp} * @default 1 * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#setScale + * @see Phaser.GameObjects.Particles.ParticleEmitter#setScaleX */ this.scaleX = new EmitterOp(config, 'scaleX', 1); /** - * [description] + * The vertical scale of emitted particles. * * @name Phaser.GameObjects.Particles.ParticleEmitter#scaleY - * @type {float} + * @type {Phaser.GameObjects.Particles.EmitterOp} * @default 1 * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#setScale + * @see Phaser.GameObjects.Particles.ParticleEmitter#setScaleY */ this.scaleY = new EmitterOp(config, 'scaleY', 1); /** - * [description] + * Color tint applied to emitted particles. Any alpha component (0xAA000000) is ignored. * * @name Phaser.GameObjects.Particles.ParticleEmitter#tint - * @type {integer} + * @type {Phaser.GameObjects.Particles.EmitterOp} + * @default 0xffffffff * @since 3.0.0 */ this.tint = new EmitterOp(config, 'tint', 0xffffffff); /** - * [description] + * The alpha (transparency) of emitted particles. * * @name Phaser.GameObjects.Particles.ParticleEmitter#alpha - * @type {float} + * @type {Phaser.GameObjects.Particles.EmitterOp} * @default 1 * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#setAlpha */ this.alpha = new EmitterOp(config, 'alpha', 1); /** - * [description] + * The lifespan of emitted particles, in ms. * * @name Phaser.GameObjects.Particles.ParticleEmitter#lifespan - * @type {number} + * @type {Phaser.GameObjects.Particles.EmitterOp} * @default 1000 * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#setLifespan */ this.lifespan = new EmitterOp(config, 'lifespan', 1000); /** - * [description] + * The angle of the initial velocity of emitted particles, in degrees. * * @name Phaser.GameObjects.Particles.ParticleEmitter#angle - * @type {number} + * @type {Phaser.GameObjects.Particles.EmitterOp} + * @default { min: 0, max: 360 } * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#setAngle */ this.angle = new EmitterOp(config, 'angle', { min: 0, max: 360 }); /** - * [description] + * The rotation of emitted particles, in degrees. * * @name Phaser.GameObjects.Particles.ParticleEmitter#rotate - * @type {number} + * @type {Phaser.GameObjects.Particles.EmitterOp} * @default 0 * @since 3.0.0 */ this.rotate = new EmitterOp(config, 'rotate', 0); /** - * [description] + * A function to call when a particle is emitted. * * @name Phaser.GameObjects.Particles.ParticleEmitter#emitCallback * @type {?ParticleEmitterCallback} @@ -422,7 +554,7 @@ var ParticleEmitter = new Class({ this.emitCallback = null; /** - * [description] + * The calling context for {@link Phaser.GameObjects.Particles.ParticleEmitter#emitCallback}. * * @name Phaser.GameObjects.Particles.ParticleEmitter#emitCallbackScope * @type {?*} @@ -432,7 +564,7 @@ var ParticleEmitter = new Class({ this.emitCallbackScope = null; /** - * [description] + * A function to call when a particle dies. * * @name Phaser.GameObjects.Particles.ParticleEmitter#deathCallback * @type {?ParticleDeathCallback} @@ -442,7 +574,7 @@ var ParticleEmitter = new Class({ this.deathCallback = null; /** - * [description] + * The calling context for {@link Phaser.GameObjects.Particles.ParticleEmitter#deathCallback}. * * @name Phaser.GameObjects.Particles.ParticleEmitter#deathCallbackScope * @type {?*} @@ -456,19 +588,21 @@ var ParticleEmitter = new Class({ * 0 means unlimited. * * @name Phaser.GameObjects.Particles.ParticleEmitter#maxParticles - * @type {number} + * @type {integer} * @default 0 * @since 3.0.0 */ this.maxParticles = 0; /** - * How many particles are emitted each time the emitter updates. + * How many particles are emitted each time particles are emitted (one explosion or one flow cycle). * * @name Phaser.GameObjects.Particles.ParticleEmitter#quantity - * @type {number} + * @type {Phaser.GameObjects.Particles.EmitterOp} * @default 1 * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#setFrequency + * @see Phaser.GameObjects.Particles.ParticleEmitter#setQuantity */ this.quantity = new EmitterOp(config, 'quantity', 1, true); @@ -476,27 +610,31 @@ var ParticleEmitter = new Class({ * How many ms to wait after emission before the particles start updating. * * @name Phaser.GameObjects.Particles.ParticleEmitter#delay - * @type {number} - * @default 1 + * @type {Phaser.GameObjects.Particles.EmitterOp} + * @default 0 * @since 3.0.0 */ this.delay = new EmitterOp(config, 'delay', 0, true); /** - * How often a particle is emitted in ms (if emitter is a constant / flow emitter) - * If emitter is an explosion emitter this value will be -1. - * Anything > -1 sets this to be a flow emitter. + * For a flow emitter, the time interval (>= 0) between particle flow cycles in ms. + * A value of 0 means there is one particle flow cycle for each logic update (the maximum flow frequency). This is the default setting. + * For an exploding emitter, this value will be -1. + * Calling {@link Phaser.GameObjects.Particles.ParticleEmitter#flow} also puts the emitter in flow mode (frequency >= 0). + * Calling {@link Phaser.GameObjects.Particles.ParticleEmitter#explode} also puts the emitter in explode mode (frequency = -1). * * @name Phaser.GameObjects.Particles.ParticleEmitter#frequency - * @type {number} + * @type {float} * @default 0 * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#setFrequency */ this.frequency = 0; /** - * Controls if the emitter is currently emitting particles. + * Controls if the emitter is currently emitting a particle flow (when frequency >= 0). * Already alive particles will continue to update until they expire. + * Controlled by {@link Phaser.GameObjects.Particles.ParticleEmitter#start}. * * @name Phaser.GameObjects.Particles.ParticleEmitter#on * @type {boolean} @@ -517,47 +655,50 @@ var ParticleEmitter = new Class({ this.particleBringToTop = true; /** - * [description] + * The time rate applied to active particles, affecting lifespan, movement, and tweens. Values larger than 1 are faster than normal. * * @name Phaser.GameObjects.Particles.ParticleEmitter#timeScale - * @type {number} + * @type {float} * @default 1 * @since 3.0.0 */ this.timeScale = 1; /** - * [description] + * An object describing a shape to emit particles from. * * @name Phaser.GameObjects.Particles.ParticleEmitter#emitZone - * @type {?object} + * @type {?Phaser.GameObjects.Particles.Zones.EdgeZone|Phaser.GameObjects.Particles.Zones.RandomZone} * @default null * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#setEmitZone */ this.emitZone = null; /** - * [description] + * An object describing a shape that deactivates particles when they interact with it. * * @name Phaser.GameObjects.Particles.ParticleEmitter#deathZone - * @type {?object} + * @type {?Phaser.GameObjects.Particles.Zones.DeathZone} * @default null * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#setDeathZone */ this.deathZone = null; /** - * [description] + * A rectangular boundary constraining particle movement. * * @name Phaser.GameObjects.Particles.ParticleEmitter#bounds * @type {?Phaser.Geom.Rectangle} * @default null * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#setBounds */ this.bounds = null; /** - * [description] + * Whether particles interact with the left edge of the emitter {@link Phaser.GameObjects.Particles.ParticleEmitter#bounds}. * * @name Phaser.GameObjects.Particles.ParticleEmitter#collideLeft * @type {boolean} @@ -567,7 +708,7 @@ var ParticleEmitter = new Class({ this.collideLeft = true; /** - * [description] + * Whether particles interact with the right edge of the emitter {@link Phaser.GameObjects.Particles.ParticleEmitter#bounds}. * * @name Phaser.GameObjects.Particles.ParticleEmitter#collideRight * @type {boolean} @@ -577,7 +718,7 @@ var ParticleEmitter = new Class({ this.collideRight = true; /** - * [description] + * Whether particles interact with the top edge of the emitter {@link Phaser.GameObjects.Particles.ParticleEmitter#bounds}. * * @name Phaser.GameObjects.Particles.ParticleEmitter#collideTop * @type {boolean} @@ -587,7 +728,7 @@ var ParticleEmitter = new Class({ this.collideTop = true; /** - * [description] + * Whether particles interact with the bottom edge of the emitter {@link Phaser.GameObjects.Particles.ParticleEmitter#bounds}. * * @name Phaser.GameObjects.Particles.ParticleEmitter#collideBottom * @type {boolean} @@ -597,7 +738,10 @@ var ParticleEmitter = new Class({ this.collideBottom = true; /** - * [description] + * Whether this emitter updates itself and its particles. + * + * Controlled by {@link Phaser.GameObjects.Particles.ParticleEmitter#pause} + * and {@link Phaser.GameObjects.Particles.ParticleEmitter#resume}. * * @name Phaser.GameObjects.Particles.ParticleEmitter#active * @type {boolean} @@ -607,85 +751,95 @@ var ParticleEmitter = new Class({ this.active = true; /** - * [description] + * Set this to false to hide any active particles. * * @name Phaser.GameObjects.Particles.ParticleEmitter#visible * @type {boolean} * @default true * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#setVisible */ this.visible = true; /** - * [description] + * The blend mode of this emitter's particles. * * @name Phaser.GameObjects.Particles.ParticleEmitter#blendMode * @type {integer} * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#setBlendMode */ this.blendMode = BlendModes.NORMAL; /** - * [description] + * A Game Object whose position is used as the particle origin. * * @name Phaser.GameObjects.Particles.ParticleEmitter#follow - * @type {?Phaser.GameObjects.Particles.Particle} + * @type {?Phaser.GameObjects.GameObject} * @default null * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#startFollow + * @see Phaser.GameObjects.Particles.ParticleEmitter#stopFollow */ this.follow = null; /** - * [description] + * The offset of the particle origin from the {@link Phaser.GameObjects.Particles.ParticleEmitter#follow} target. * * @name Phaser.GameObjects.Particles.ParticleEmitter#followOffset * @type {Phaser.Math.Vector2} * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#startFollow */ this.followOffset = new Vector2(); /** - * [description] + * Whether the emitter's {@link Phaser.GameObjects.Particles.ParticleEmitter#visible} state will track + * the {@link Phaser.GameObjects.Particles.ParticleEmitter#follow} target's visibility state. * * @name Phaser.GameObjects.Particles.ParticleEmitter#trackVisible * @type {boolean} * @default false * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#startFollow */ this.trackVisible = false; /** - * [description] + * The current texture frame, as an index of {@link Phaser.GameObjects.Particles.ParticleEmitter#frames}. * * @name Phaser.GameObjects.Particles.ParticleEmitter#currentFrame - * @type {number} + * @type {integer} * @default 0 * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#setFrame */ this.currentFrame = 0; /** - * [description] + * Whether texture {@link Phaser.GameObjects.Particles.ParticleEmitter#frames} are selected at random. * * @name Phaser.GameObjects.Particles.ParticleEmitter#randomFrame * @type {boolean} * @default true * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#setFrame */ this.randomFrame = true; /** - * [description] + * The number of consecutive particles that receive a single texture frame (per frame cycle). * * @name Phaser.GameObjects.Particles.ParticleEmitter#frameQuantity - * @type {number} + * @type {integer} * @default 1 * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#setFrame */ this.frameQuantity = 1; /** - * [description] + * Inactive particles. * * @name Phaser.GameObjects.Particles.ParticleEmitter#dead * @type {Phaser.GameObjects.Particles.Particle[]} @@ -695,7 +849,7 @@ var ParticleEmitter = new Class({ this.dead = []; /** - * [description] + * Active particles * * @name Phaser.GameObjects.Particles.ParticleEmitter#alive * @type {Phaser.GameObjects.Particles.Particle[]} @@ -705,10 +859,10 @@ var ParticleEmitter = new Class({ this.alive = []; /** - * [description] + * The time until the next flow cycle. * * @name Phaser.GameObjects.Particles.ParticleEmitter#_counter - * @type {number} + * @type {float} * @private * @default 0 * @since 3.0.0 @@ -716,10 +870,10 @@ var ParticleEmitter = new Class({ this._counter = 0; /** - * [description] + * Counts up to {@link Phaser.GameObjects.Particles.ParticleEmitter#frameQuantity}. * * @name Phaser.GameObjects.Particles.ParticleEmitter#_frameCounter - * @type {number} + * @type {integer} * @private * @default 0 * @since 3.0.0 @@ -733,12 +887,12 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Merges configuration settings into the emitter's current settings. * * @method Phaser.GameObjects.Particles.ParticleEmitter#fromJSON * @since 3.0.0 * - * @param {object} config - [description] + * @param {ParticleEmitterConfig} config - Settings for this emitter. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -786,7 +940,7 @@ var ParticleEmitter = new Class({ this.speedY = null; } - // If you specify speedX, speedY ot moveTo then it changes the emitter from radial to a point emitter + // If you specify speedX, speedY or moveTo then it changes the emitter from radial to a point emitter if (HasAny(config, [ 'speedX', 'speedY' ]) || this.moveTo) { this.radial = false; @@ -837,14 +991,14 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Creates a description of this emitter suitable for JSON serialization. * * @method Phaser.GameObjects.Particles.ParticleEmitter#toJSON * @since 3.0.0 * - * @param {object} output - [description] + * @param {object} [output] - An object to copy output into. * - * @return {object} [description] + * @return {object} - The output object. */ toJSON: function (output) { @@ -887,15 +1041,15 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Continuously moves the particle origin to follow a Game Object's position. * * @method Phaser.GameObjects.Particles.ParticleEmitter#startFollow * @since 3.0.0 * - * @param {Phaser.GameObjects.Particles.Particle} target - [description] - * @param {number} [offsetX=0] - [description] - * @param {number} [offsetY=0] - [description] - * @param {boolean} [trackVisible=false] - [description] + * @param {Phaser.GameObjects.Particles.Particle} target - The Game Object to follow. + * @param {float} [offsetX=0] - Horizontal offset of the particle origin from the Game Object. + * @param {float} [offsetY=0] - Vertical offset of the particle origin from the Game Object. + * @param {boolean} [trackVisible=false] - Whether the emitter's visible state will track the target's visible state. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -913,7 +1067,7 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Stops following a Game Object. * * @method Phaser.GameObjects.Particles.ParticleEmitter#stopFollow * @since 3.0.0 @@ -930,12 +1084,12 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Chooses a texture frame from {@link Phaser.GameObjects.Particles.ParticleEmitter#frames}. * * @method Phaser.GameObjects.Particles.ParticleEmitter#getFrame * @since 3.0.0 * - * @return {Phaser.Textures.Frame} [description] + * @return {Phaser.Textures.Frame} The texture frame. */ getFrame: function () { @@ -970,14 +1124,14 @@ var ParticleEmitter = new Class({ // frame: { frames: [ 'red', 'green', 'blue', 'pink', 'white' ], [cycle: bool], [quantity: int] } /** - * [description] + * Sets a pattern for assigning texture frames to emitted particles. * * @method Phaser.GameObjects.Particles.ParticleEmitter#setFrame * @since 3.0.0 * - * @param {(array|string|integer|object)} frames - [description] - * @param {boolean} [pickRandom=true] - [description] - * @param {integer} [quantity=1] - [description] + * @param {(array|string|integer|ParticleEmitterFrameConfig)} frames - One or more texture frames, or a configuration object. + * @param {boolean} [pickRandom=true] - Whether frames should be assigned at random from `frames`. + * @param {integer} [quantity=1] - The number of consecutive particles that will receive each frame. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1027,12 +1181,12 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Turns {@link Phaser.GameObjects.Particles.ParticleEmitter#radial} particle movement on or off. * * @method Phaser.GameObjects.Particles.ParticleEmitter#setRadial * @since 3.0.0 * - * @param {boolean} value - [description] + * @param {boolean} [value=true] - Radial mode (true) or point mode (true). * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1046,13 +1200,14 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Sets the position of the emitter's particle origin. + * New particles will be emitted here. * * @method Phaser.GameObjects.Particles.ParticleEmitter#setPosition * @since 3.0.0 * - * @param {number} x - [description] - * @param {number} y - [description] + * @param {float|float[]|EmitterOpOnEmitCallback|object} x - The x-coordinate of the particle origin. + * @param {float|float[]|EmitterOpOnEmitCallback|object} y - The y-coordinate of the particle origin. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1065,15 +1220,17 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Sets or modifies a rectangular boundary constraining the particles. + * + * To remove the boundary, set {@link Phaser.GameObjects.Particles.ParticleEmitter#bounds} to null. * * @method Phaser.GameObjects.Particles.ParticleEmitter#setBounds * @since 3.0.0 * - * @param {(number|object)} x - [description] - * @param {number} y - [description] - * @param {number} width - [description] - * @param {number} height - [description] + * @param {(number|ParticleEmitterBounds|ParticleEmitterBoundsAlt)} x - The x-coordinate of the left edge of the boundary, or an object representing a rectangle. + * @param {float} y - The y-coordinate of the top edge of the boundary. + * @param {float} width - The width of the boundary. + * @param {float} height - The height of the boundary. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1102,12 +1259,13 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Sets the initial horizontal speed of emitted particles. + * Changes the emitter to point mode. * * @method Phaser.GameObjects.Particles.ParticleEmitter#setSpeedX * @since 3.0.0 * - * @param {number} value - [description] + * @param {float|float[]|EmitterOpOnEmitCallback|object} value - The speed, in pixels per second. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1122,12 +1280,13 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Sets the initial vertical speed of emitted particles. + * Changes the emitter to point mode. * * @method Phaser.GameObjects.Particles.ParticleEmitter#setSpeedY * @since 3.0.0 * - * @param {number} value - [description] + * @param {float|float[]|EmitterOpOnEmitCallback|object} value - The speed, in pixels per second. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1145,12 +1304,13 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Sets the initial radial speed of emitted particles. + * Changes the emitter to radial mode. * * @method Phaser.GameObjects.Particles.ParticleEmitter#setSpeed * @since 3.0.0 * - * @param {number} value - [description] + * @param {float|float[]|EmitterOpOnEmitCallback|object} value - The speed, in pixels per second. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1166,12 +1326,12 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Sets the horizontal scale of emitted particles. * * @method Phaser.GameObjects.Particles.ParticleEmitter#setScaleX * @since 3.0.0 * - * @param {number} value - [description] + * @param {float|float[]|EmitterOpOnUpdateCallback|object} value - The scale, relative to 1. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1183,12 +1343,12 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Sets the vertical scale of emitted particles. * * @method Phaser.GameObjects.Particles.ParticleEmitter#setScaleY * @since 3.0.0 * - * @param {number} value - [description] + * @param {float|float[]|EmitterOpOnUpdateCallback|object} value - The scale, relative to 1. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1200,12 +1360,12 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Sets the scale of emitted particles. * * @method Phaser.GameObjects.Particles.ParticleEmitter#setScale * @since 3.0.0 * - * @param {number} value - [description] + * @param {float|float[]|EmitterOpOnUpdateCallback|object} value - The scale, relative to 1. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1218,12 +1378,12 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Sets the horizontal gravity applied to emitted particles. * * @method Phaser.GameObjects.Particles.ParticleEmitter#setGravityX * @since 3.0.0 * - * @param {number} value - [description] + * @param {float} value - Acceleration due to gravity, in pixels per second squared. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1235,12 +1395,12 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Sets the vertical gravity applied to emitted particles. * * @method Phaser.GameObjects.Particles.ParticleEmitter#setGravityY * @since 3.0.0 * - * @param {number} value - [description] + * @param {float} value - Acceleration due to gravity, in pixels per second squared. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1252,13 +1412,13 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Sets the gravity applied to emitted particles. * * @method Phaser.GameObjects.Particles.ParticleEmitter#setGravity * @since 3.0.0 * - * @param {number} x - [description] - * @param {number} y - [description] + * @param {float} x - Horizontal acceleration due to gravity, in pixels per second squared. + * @param {float} y - Vertical acceleration due to gravity, in pixels per second squared. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1271,12 +1431,12 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Sets the opacity of emitted particles. * * @method Phaser.GameObjects.Particles.ParticleEmitter#setAlpha * @since 3.0.0 * - * @param {float} value - [description] + * @param {float|float[]|EmitterOpOnUpdateCallback|object} value - A value between 0 (transparent) and 1 (opaque). * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1288,12 +1448,12 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Sets the angle of a {@link Phaser.GameObjects.Particles.ParticleEmitter#radial} particle stream. * * @method Phaser.GameObjects.Particles.ParticleEmitter#setEmitterAngle * @since 3.0.0 * - * @param {number} value - [description] + * @param {float|float[]|EmitterOpOnEmitCallback|object} value - The angle of the initial velocity of emitted particles. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1305,12 +1465,12 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Sets the angle of a {@link Phaser.GameObjects.Particles.ParticleEmitter#radial} particle stream. * * @method Phaser.GameObjects.Particles.ParticleEmitter#setAngle * @since 3.0.0 * - * @param {number} value - [description] + * @param {float|float[]|EmitterOpOnEmitCallback|object} value - The angle of the initial velocity of emitted particles. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1322,12 +1482,12 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Sets the lifespan of newly emitted particles. * * @method Phaser.GameObjects.Particles.ParticleEmitter#setLifespan * @since 3.0.0 * - * @param {number} value - [description] + * @param {float|float[]|EmitterOpOnEmitCallback|object} value - The particle lifespan, in ms. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1339,12 +1499,12 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Sets the number of particles released at each flow cycle or explosion. * * @method Phaser.GameObjects.Particles.ParticleEmitter#setQuantity * @since 3.0.0 * - * @param {integer} quantity - [description] + * @param {float|float[]|EmitterOpOnEmitCallback|object} quantity - The number of particles to release at each flow cycle or explosion. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1356,13 +1516,14 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Sets the emitter's {@link Phaser.GameObjects.Particles.ParticleEmitter#frequency} + * and {@link Phaser.GameObjects.Particles.ParticleEmitter#quantity}. * * @method Phaser.GameObjects.Particles.ParticleEmitter#setFrequency * @since 3.0.0 * - * @param {number} frequency - [description] - * @param {integer} [quantity] - [description] + * @param {float} frequency - The time interval (>= 0) of each flow cycle, in ms; or -1 to put the emitter in explosion mode. + * @param {float|float[]|EmitterOpOnEmitCallback|object} [quantity] - The number of particles to release at each flow cycle or explosion. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1381,13 +1542,16 @@ var ParticleEmitter = new Class({ }, /** - * The zone must have a function called `getPoint` that takes a particle object and sets - * its x and y properties accordingly then returns that object. + * Sets or removes the {@link Phaser.GameObjects.Particles.ParticleEmitter#emitZone}. + * + * An {@link ParticleEmitterEdgeZoneConfig EdgeZone} places particles on its edges. Its {@link EdgeZoneSource source} can be a Curve, Path, Circle, Ellipse, Line, Polygon, Rectangle, or Triangle; or any object with a suitable {@link EdgeZoneSourceCallback getPoints} method. + * + * A {@link ParticleEmitterRandomZoneConfig RandomZone} places randomly within its interior. Its {@link RandomZoneSource source} can be a Circle, Ellipse, Line, Polygon, Rectangle, or Triangle; or any object with a suitable {@link RandomZoneSourceCallback getRandomPoint} method. * * @method Phaser.GameObjects.Particles.ParticleEmitter#setEmitZone * @since 3.0.0 * - * @param {object} [zoneConfig] - [description] + * @param {ParticleEmitterEdgeZoneConfig|ParticleEmitterRandomZoneConfig} [zoneConfig] - An object describing the zone, or `undefined` to remove any current emit zone. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1406,6 +1570,11 @@ var ParticleEmitter = new Class({ var type = GetFastValue(zoneConfig, 'type', 'random'); var source = GetFastValue(zoneConfig, 'source', null); + // TODO: + // For an EdgeZone, only source.getPoints(quantity, stepRate) is required. + // For a RandomZone, only source.getRandomPoint(point) is required. + // Any object implementing getPoint(position) could also be assigned here (instead of new EdgeZone, new RandomZone). + if (source && typeof source.getPoint === 'function') { switch (type) @@ -1434,12 +1603,12 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Sets or removes the {@link Phaser.GameObjects.Particles.ParticleEmitter#deathZone}. * * @method Phaser.GameObjects.Particles.ParticleEmitter#setDeathZone * @since 3.0.0 * - * @param {object} [zoneConfig] - [description] + * @param {ParticleEmitterDeathZoneConfig} [zoneConfig] - An object describing the zone, or `undefined` to remove any current death zone. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1470,12 +1639,12 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Creates inactive particles and adds them to this emitter's pool. * * @method Phaser.GameObjects.Particles.ParticleEmitter#reserve * @since 3.0.0 * - * @param {integer} particleCount - [description] + * @param {integer} particleCount - The number of particles to create. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1492,12 +1661,12 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Gets the number of active (in-use) particles in this emitter. * * @method Phaser.GameObjects.Particles.ParticleEmitter#getAliveParticleCount * @since 3.0.0 * - * @return {integer} The number of currently alive Particles in this Emitter. + * @return {integer} The number of particles with `active=true`. */ getAliveParticleCount: function () { @@ -1505,12 +1674,12 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Gets the number of inactive (available) particles in this emitter. * * @method Phaser.GameObjects.Particles.ParticleEmitter#getDeadParticleCount * @since 3.0.0 * - * @return {integer} The number of currently dead Particles in this Emitter. + * @return {integer} The number of particles with `active=false`. */ getDeadParticleCount: function () { @@ -1518,12 +1687,12 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Gets the total number of particles in this emitter. * * @method Phaser.GameObjects.Particles.ParticleEmitter#getParticleCount * @since 3.0.0 * - * @return {integer} The number of Particles in this Emitter, including both alive and dead. + * @return {integer} The number of particles, including both alive and dead. */ getParticleCount: function () { @@ -1531,7 +1700,7 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Whether this emitter is at its limit (if set). * * @method Phaser.GameObjects.Particles.ParticleEmitter#atLimit * @since 3.0.0 @@ -1544,13 +1713,13 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Sets a function to call for each newly emitted particle. * * @method Phaser.GameObjects.Particles.ParticleEmitter#onParticleEmit * @since 3.0.0 * - * @param {ParticleEmitterCallback} callback - [description] - * @param {*} [context] - [description] + * @param {ParticleEmitterCallback} callback - The function. + * @param {*} [context] - The calling context. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1576,13 +1745,13 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Sets a function to call for each particle death. * * @method Phaser.GameObjects.Particles.ParticleEmitter#onParticleDeath * @since 3.0.0 * - * @param {ParticleDeathCallback} callback - [description] - * @param {*} [context] - [description] + * @param {ParticleDeathCallback} callback - The function. + * @param {*} [context] - The function's calling context. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1608,7 +1777,7 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Deactivates every particle in this emitter. * * @method Phaser.GameObjects.Particles.ParticleEmitter#killAll * @since 3.0.0 @@ -1629,13 +1798,13 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Calls a function for each active particle in this emitter. * * @method Phaser.GameObjects.Particles.ParticleEmitter#forEachAlive * @since 3.0.0 * - * @param {ParticleEmitterCallback} callback - [description] - * @param {*} thisArg - [description] + * @param {ParticleEmitterCallback} callback - The function. + * @param {*} thisArg - The function's calling context. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1654,13 +1823,13 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Calls a function for each inactive particle in this emitter. * * @method Phaser.GameObjects.Particles.ParticleEmitter#forEachDead * @since 3.0.0 * - * @param {ParticleEmitterCallback} callback - [description] - * @param {*} thisArg - [description] + * @param {ParticleEmitterCallback} callback - The function. + * @param {*} thisArg - The function's calling context. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1679,7 +1848,12 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Turns {@link Phaser.GameObjects.Particles.ParticleEmitter#on} the emitter and resets the flow counter. + * + * If this emitter is in flow mode (frequency >= 0; the default), the particle flow will start (or restart). + * + * If this emitter is in explode mode (frequency = -1), nothing will happen. + * Use {@link Phaser.GameObjects.Particles.ParticleEmitter#explode} or {@link Phaser.GameObjects.Particles.ParticleEmitter#flow} instead. * * @method Phaser.GameObjects.Particles.ParticleEmitter#start * @since 3.0.0 @@ -1696,7 +1870,7 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * {@link Phaser.GameObjects.Particles.ParticleEmitter#active Deactivates} the emitter. * * @method Phaser.GameObjects.Particles.ParticleEmitter#pause * @since 3.0.0 @@ -1711,7 +1885,7 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * {@link Phaser.GameObjects.Particles.ParticleEmitter#active Activates} the emitter. * * @method Phaser.GameObjects.Particles.ParticleEmitter#resume * @since 3.0.0 @@ -1726,7 +1900,7 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Sorts active particles with {@link Phaser.GameObjects.Particles.ParticleEmitter#depthSortCallback}. * * @method Phaser.GameObjects.Particles.ParticleEmitter#depthSort * @since 3.0.0 @@ -1741,13 +1915,15 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Puts the emitter in flow mode (frequency >= 0) and starts (or restarts) a particle flow. + * + * To resume a flow at the current frequency and quantity, use {@link Phaser.GameObjects.Particles.ParticleEmitter#start} instead. * * @method Phaser.GameObjects.Particles.ParticleEmitter#flow * @since 3.0.0 * - * @param {number} frequency - [description] - * @param {integer} [count=1] - [description] + * @param {float} frequency - The time interval (>= 0) of each flow cycle, in ms. + * @param {float|float[]|EmitterOpOnEmitCallback|object} [count=1] - The number of particles to emit at each flow cycle. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1763,14 +1939,14 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Puts the emitter in explode mode (frequency = -1), stopping any current particle flow, and emits several particles all at once. * * @method Phaser.GameObjects.Particles.ParticleEmitter#explode * @since 3.0.0 * * @param {integer} count - The amount of Particles to emit. - * @param {number} x - The x coordinate to emit the Particles from. - * @param {number} y - The y coordinate to emit the Particles from. + * @param {float} x - The x coordinate to emit the Particles from. + * @param {float} y - The y coordinate to emit the Particles from. * * @return {Phaser.GameObjects.Particles.Particle} The most recently emitted Particle. */ @@ -1782,14 +1958,14 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Emits particles at a given position (or the emitter's current position). * * @method Phaser.GameObjects.Particles.ParticleEmitter#emitParticleAt * @since 3.0.0 * - * @param {number} x - The x coordinate to emit the Particles from. - * @param {number} y - The y coordinate to emit the Particles from. - * @param {integer} count - The amount of Particles to emit. + * @param {float} [x=this.x] - The x coordinate to emit the Particles from. + * @param {float} [y=this.x] - The y coordinate to emit the Particles from. + * @param {integer} [count=this.quantity] - The number of Particles to emit. * * @return {Phaser.GameObjects.Particles.Particle} The most recently emitted Particle. */ @@ -1799,16 +1975,18 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Emits particles at a given position (or the emitter's current position). * * @method Phaser.GameObjects.Particles.ParticleEmitter#emitParticle * @since 3.0.0 * - * @param {integer} count - The amount of Particles to emit. - * @param {number} x - The x coordinate to emit the Particles from. - * @param {number} y - The y coordinate to emit the Particles from. + * @param {integer} [count=this.quantity] - The number of Particles to emit. + * @param {float} [x=this.x] - The x coordinate to emit the Particles from. + * @param {float} [y=this.x] - The y coordinate to emit the Particles from. * * @return {Phaser.GameObjects.Particles.Particle} The most recently emitted Particle. + * + * @see Phaser.GameObjects.Particles.Particle#fire */ emitParticle: function (count, x, y) { @@ -1863,13 +2041,13 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Updates this emitter and its particles. * * @method Phaser.GameObjects.Particles.ParticleEmitter#preUpdate * @since 3.0.0 * * @param {integer} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. - * @param {number} delta - The delta time, in ms, elapsed since the last frame. + * @param {float} delta - The delta time, in ms, elapsed since the last frame. */ preUpdate: function (time, delta) { @@ -1954,15 +2132,15 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Calculates the difference of two particles, for sorting them by depth. * * @method Phaser.GameObjects.Particles.ParticleEmitter#depthSortCallback * @since 3.0.0 * - * @param {object} a - [description] - * @param {object} b - [description] + * @param {object} a - The first particle. + * @param {object} b - The second particle. * - * @return {integer} [description] + * @return {integer} The difference of a and b's y coordinates. */ depthSortCallback: function (a, b) { @@ -1970,15 +2148,15 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Calculates the difference of two particles, for sorting them by index. * * @method Phaser.GameObjects.Particles.ParticleEmitter#indexSortCallback * @since 3.0.0 * - * @param {object} a - [description] - * @param {object} b - [description] + * @param {object} a - The first particle. + * @param {object} b - The second particle. * - * @return {integer} [description] + * @return {integer} The difference of a and b's `index` properties. */ indexSortCallback: function (a, b) { diff --git a/src/gameobjects/particles/ParticleEmitterManager.js b/src/gameobjects/particles/ParticleEmitterManager.js index 605c318ce..9bf30d4b2 100644 --- a/src/gameobjects/particles/ParticleEmitterManager.js +++ b/src/gameobjects/particles/ParticleEmitterManager.js @@ -14,7 +14,7 @@ var Render = require('./ParticleManagerRender'); /** * @classdesc - * [description] + * A Particle Emitter Manager creates and controls {@link Phaser.GameObjects.Particles.ParticleEmitter Particle Emitters} and {@link Phaser.GameObjects.Particles.GravityWell Gravity Wells}. * * @class ParticleEmitterManager * @extends Phaser.GameObjects.GameObject @@ -26,10 +26,10 @@ var Render = require('./ParticleManagerRender'); * @extends Phaser.GameObjects.Particles.Components.Visible * @extends Phaser.GameObjects.Particles.Components.Pipeline * - * @param {Phaser.Scene} scene - [description] - * @param {string} texture - [description] - * @param {(string|integer)} frame - [description] - * @param {Phaser.GameObjects.Particles.ParticleEmitter[]} emitters - [description] + * @param {Phaser.Scene} scene - The Scene to which this Emitter Manager belongs. + * @param {string} texture - The key of the Texture this Emitter Manager will use to render particles, as stored in the Texture Manager. + * @param {(string|integer)} frame - An optional frame from the Texture this Emitter Manager will use to render particles. + * @param {ParticleEmitterConfig|ParticleEmitterConfig[]} emitters - Configuration settings for one or more emitters to create. */ var ParticleEmitterManager = new Class({ @@ -53,7 +53,7 @@ var ParticleEmitterManager = new Class({ * [description] * * @name Phaser.GameObjects.Particles.ParticleEmitterManager#blendMode - * @type {number} + * @type {integer} * @default -1 * @private * @since 3.0.0 @@ -61,7 +61,9 @@ var ParticleEmitterManager = new Class({ this.blendMode = -1; /** - * [description] + * The time scale applied to all emitters and particles, affecting flow rate, lifespan, and movement. + * Values larger than 1 are faster than normal. + * This is multiplied with any timeScale set on each individual emitter. * * @name Phaser.GameObjects.Particles.ParticleEmitterManager#timeScale * @type {float} @@ -71,7 +73,7 @@ var ParticleEmitterManager = new Class({ this.timeScale = 1; /** - * [description] + * The texture used to render this Emitter Manager's particles. * * @name Phaser.GameObjects.Particles.ParticleEmitterManager#texture * @type {Phaser.Textures.Texture} @@ -81,7 +83,7 @@ var ParticleEmitterManager = new Class({ this.texture = null; /** - * [description] + * The texture frame used to render this Emitter Manager's particles. * * @name Phaser.GameObjects.Particles.ParticleEmitterManager#frame * @type {Phaser.Textures.Frame} @@ -91,7 +93,7 @@ var ParticleEmitterManager = new Class({ this.frame = null; /** - * [description] + * Names of this Emitter Manager's texture frames. * * @name Phaser.GameObjects.Particles.ParticleEmitterManager#frameNames * @type {Phaser.Textures.Frame[]} @@ -144,7 +146,7 @@ var ParticleEmitterManager = new Class({ }, /** - * Sets the texture and frame this Game Object will use to render with. + * Sets the texture and frame this Emitter Manager will use to render with. * * Textures are referenced by their string-based keys, as stored in the Texture Manager. * @@ -154,7 +156,7 @@ var ParticleEmitterManager = new Class({ * @param {string} key - The key of the texture to be used, as stored in the Texture Manager. * @param {(string|integer)} [frame] - The name or index of the frame within the Texture. * - * @return {Phaser.GameObjects.Particles.ParticleEmitterManager} This Game Object. + * @return {Phaser.GameObjects.Particles.ParticleEmitterManager} This Emitter Manager. */ setTexture: function (key, frame) { @@ -164,7 +166,7 @@ var ParticleEmitterManager = new Class({ }, /** - * Sets the frame this Game Object will use to render with. + * Sets the frame this Emitter Manager will use to render with. * * The Frame has to belong to the current Texture being used. * @@ -175,7 +177,7 @@ var ParticleEmitterManager = new Class({ * * @param {(string|integer)} [frame] - The name or index of the frame within the Texture. * - * @return {Phaser.GameObjects.Particles.ParticleEmitterManager} This Game Object. + * @return {Phaser.GameObjects.Particles.ParticleEmitterManager} This Emitter Manager. */ setFrame: function (frame) { @@ -189,15 +191,15 @@ var ParticleEmitterManager = new Class({ }, /** - * [description] + * Assigns texture frames to an emitter. * * @method Phaser.GameObjects.Particles.ParticleEmitterManager#setEmitterFrames * @since 3.0.0 * - * @param {(Phaser.Textures.Frame|Phaser.Textures.Frame[])} frames - [description] - * @param {Phaser.GameObjects.Particles.ParticleEmitter} emitter - [description] + * @param {(Phaser.Textures.Frame|Phaser.Textures.Frame[])} frames - The texture frames. + * @param {Phaser.GameObjects.Particles.ParticleEmitter} emitter - The particle emitter to modify. * - * @return {Phaser.GameObjects.Particles.ParticleEmitterManager} This Game Object. + * @return {Phaser.GameObjects.Particles.ParticleEmitterManager} This Emitter Manager. */ setEmitterFrames: function (frames, emitter) { @@ -233,7 +235,7 @@ var ParticleEmitterManager = new Class({ }, /** - * Adds an existing Particle Emitter to this Manager. + * Adds an existing Particle Emitter to this Emitter Manager. * * @method Phaser.GameObjects.Particles.ParticleEmitterManager#addEmitter * @since 3.0.0 @@ -248,7 +250,7 @@ var ParticleEmitterManager = new Class({ }, /** - * Creates a new Particle Emitter object, adds it to this Manager and returns a reference to it. + * Creates a new Particle Emitter object, adds it to this Emitter Manager and returns a reference to it. * * @method Phaser.GameObjects.Particles.ParticleEmitterManager#createEmitter * @since 3.0.0 @@ -263,7 +265,7 @@ var ParticleEmitterManager = new Class({ }, /** - * Adds an existing Gravity Well object to this Manager. + * Adds an existing Gravity Well object to this Emitter Manager. * * @method Phaser.GameObjects.Particles.ParticleEmitterManager#addGravityWell * @since 3.0.0 @@ -278,7 +280,7 @@ var ParticleEmitterManager = new Class({ }, /** - * Creates a new Gravity Well, adds it to this Manager and returns a reference to it. + * Creates a new Gravity Well, adds it to this Emitter Manager and returns a reference to it. * * @method Phaser.GameObjects.Particles.ParticleEmitterManager#createGravityWell * @since 3.0.0 @@ -293,16 +295,16 @@ var ParticleEmitterManager = new Class({ }, /** - * [description] + * Emits particles from each active emitter. * * @method Phaser.GameObjects.Particles.ParticleEmitterManager#emitParticle * @since 3.0.0 * - * @param {integer} count - [description] - * @param {number} x - [description] - * @param {number} y - [description] + * @param {integer} [count] - The number of particles to release from each emitter. The default is the emitter's own {@link Phaser.GameObjects.Particles.ParticleEmitter#quantity}. + * @param {float} [x] - The x-coordinate to to emit particles from. The default is the x-coordinate of the emitter's current location. + * @param {float} [y] - The y-coordinate to to emit particles from. The default is the y-coordinate of the emitter's current location. * - * @return {Phaser.GameObjects.Particles.ParticleEmitterManager} This Game Object. + * @return {Phaser.GameObjects.Particles.ParticleEmitterManager} This Emitter Manager. */ emitParticle: function (count, x, y) { @@ -322,16 +324,16 @@ var ParticleEmitterManager = new Class({ }, /** - * [description] + * Emits particles from each active emitter. * * @method Phaser.GameObjects.Particles.ParticleEmitterManager#emitParticleAt * @since 3.0.0 * - * @param {number} x - [description] - * @param {number} y - [description] - * @param {integer} count - [description] + * @param {float} [x] - The x-coordinate to to emit particles from. The default is the x-coordinate of the emitter's current location. + * @param {float} [y] - The y-coordinate to to emit particles from. The default is the y-coordinate of the emitter's current location. + * @param {integer} [count] - The number of particles to release from each emitter. The default is the emitter's own {@link Phaser.GameObjects.Particles.ParticleEmitter#quantity}. * - * @return {Phaser.GameObjects.Particles.ParticleEmitterManager} This Game Object. + * @return {Phaser.GameObjects.Particles.ParticleEmitterManager} This Emitter Manager. */ emitParticleAt: function (x, y, count) { @@ -348,7 +350,7 @@ var ParticleEmitterManager = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitterManager#pause * @since 3.0.0 * - * @return {Phaser.GameObjects.Particles.ParticleEmitterManager} This Game Object. + * @return {Phaser.GameObjects.Particles.ParticleEmitterManager} This Emitter Manager. */ pause: function () { @@ -363,7 +365,7 @@ var ParticleEmitterManager = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitterManager#resume * @since 3.0.0 * - * @return {Phaser.GameObjects.Particles.ParticleEmitterManager} This Game Object. + * @return {Phaser.GameObjects.Particles.ParticleEmitterManager} This Emitter Manager. */ resume: function () { @@ -373,12 +375,12 @@ var ParticleEmitterManager = new Class({ }, /** - * [description] + * Gets all active particle processors (gravity wells). * * @method Phaser.GameObjects.Particles.ParticleEmitterManager#getProcessors * @since 3.0.0 * - * @return {Phaser.GameObjects.Particles.GravityWell[]} [description] + * @return {Phaser.GameObjects.Particles.GravityWell[]} - The active gravity wells. */ getProcessors: function () { @@ -386,13 +388,13 @@ var ParticleEmitterManager = new Class({ }, /** - * [description] + * Updates all active emitters. * * @method Phaser.GameObjects.Particles.ParticleEmitterManager#preUpdate * @since 3.0.0 * * @param {integer} time - The current timestamp as generated by the Request Animation Frame or SetTimeout. - * @param {number} delta - The delta time, in ms, elapsed since the last frame. + * @param {float} delta - The delta time, in ms, elapsed since the last frame. */ preUpdate: function (time, delta) { diff --git a/src/gameobjects/particles/zones/DeathZone.js b/src/gameobjects/particles/zones/DeathZone.js index ff05c4bcc..a5418cf38 100644 --- a/src/gameobjects/particles/zones/DeathZone.js +++ b/src/gameobjects/particles/zones/DeathZone.js @@ -6,6 +6,27 @@ var Class = require('../../../utils/Class'); +/** + * @callback DeathZoneSourceCallback + * + * @param {float} x - [description] + * @param {float} y - [description] + * + * @return {boolean} - True if the coordinates are within the source area. + */ + +/** + * @typedef {object} DeathZoneSource + * + * @property {DeathZoneSourceCallback} contains + * + * @see Phaser.Geom.Circle + * @see Phaser.Geom.Ellipse + * @see Phaser.Geom.Polygon + * @see Phaser.Geom.Rectangle + * @see Phaser.Geom.Triangle + */ + /** * @classdesc * A Death Zone. @@ -20,7 +41,7 @@ var Class = require('../../../utils/Class'); * @constructor * @since 3.0.0 * - * @param {object} source - An object instance that has a `contains` method that returns a boolean when given `x` and `y` arguments. + * @param {DeathZoneSource} source - An object instance that has a `contains` method that returns a boolean when given `x` and `y` arguments. * @param {boolean} killOnEnter - Should the Particle be killed when it enters the zone? `true` or leaves it? `false` */ var DeathZone = new Class({ @@ -34,7 +55,7 @@ var DeathZone = new Class({ * This could be a Geometry shape, such as `Phaser.Geom.Circle`, or your own custom object. * * @name Phaser.GameObjects.Particles.Zones.DeathZone#source - * @type {object} + * @type {DeathZoneSource} * @since 3.0.0 */ this.source = source; diff --git a/src/gameobjects/particles/zones/EdgeZone.js b/src/gameobjects/particles/zones/EdgeZone.js index 1fc2b349e..992662ffc 100644 --- a/src/gameobjects/particles/zones/EdgeZone.js +++ b/src/gameobjects/particles/zones/EdgeZone.js @@ -6,16 +6,40 @@ var Class = require('../../../utils/Class'); +/** + * @callback EdgeZoneSourceCallback + * + * @param {integer} quantity - [description] + * @param {integer} [stepRate] - [description] + * + * @return {Phaser.Geom.Point[]} - [description] + */ + +/** + * @typedef {object} EdgeZoneSource + * + * @property {EdgeZoneSourceCallback} getPoints - A function placing points on the source's edge or edges. + * + * @see Phaser.Curves.Curve + * @see Phaser.Curves.Path + * @see Phaser.Geom.Circle + * @see Phaser.Geom.Ellipse + * @see Phaser.Geom.Line + * @see Phaser.Geom.Polygon + * @see Phaser.Geom.Rectangle + * @see Phaser.Geom.Triangle + */ + /** * @classdesc - * [description] + * A zone that places particles on a shape's edges. * * @class EdgeZone * @memberOf Phaser.GameObjects.Particles.Zones * @constructor * @since 3.0.0 * - * @param {object} source - [description] + * @param {EdgeZoneSource} source - An object instance with a `getPoints(quantity, stepRate)` method returning an array of points. * @param {number} quantity - [description] * @param {number} stepRate - [description] * @param {boolean} [yoyo=false] - [description] @@ -34,7 +58,7 @@ var EdgeZone = new Class({ * [description] * * @name Phaser.GameObjects.Particles.Zones.EdgeZone#source - * @type {object} + * @type {EdgeZoneSource|RandomZoneSource} * @since 3.0.0 */ this.source = source; diff --git a/src/gameobjects/particles/zones/RandomZone.js b/src/gameobjects/particles/zones/RandomZone.js index 63e898301..97205045a 100644 --- a/src/gameobjects/particles/zones/RandomZone.js +++ b/src/gameobjects/particles/zones/RandomZone.js @@ -7,16 +7,35 @@ var Class = require('../../../utils/Class'); var Vector2 = require('../../../math/Vector2'); +/** + * @callback RandomZoneSourceCallback + * + * @param {Phaser.Math.Vector2} point - A point to modify. + */ + +/** + * @typedef {object} RandomZoneSource + * + * @property {RandomZoneSourceCallback} getRandomPoint - A function modifying its point argument. + * + * @see Phaser.Geom.Circle + * @see Phaser.Geom.Ellipse + * @see Phaser.Geom.Line + * @see Phaser.Geom.Polygon + * @see Phaser.Geom.Rectangle + * @see Phaser.Geom.Triangle + */ + /** * @classdesc - * [description] + * A zone that places particles randomly within a shape's area. * * @class RandomZone * @memberOf Phaser.GameObjects.Particles.Zones * @constructor * @since 3.0.0 * - * @param {object} source - [description] + * @param {RandomZoneSource} source - An object instance with a `getRandomPoint(point)` method. */ var RandomZone = new Class({ @@ -28,7 +47,7 @@ var RandomZone = new Class({ * [description] * * @name Phaser.GameObjects.Particles.Zones.RandomZone#source - * @type {object} + * @type {RandomZoneSource} * @since 3.0.0 */ this.source = source; diff --git a/src/math/Difference.js b/src/math/Difference.js index fe261f713..4e39dd497 100644 --- a/src/math/Difference.js +++ b/src/math/Difference.js @@ -5,15 +5,15 @@ */ /** - * [description] + * Calculates the positive difference of two given numbers. * * @function Phaser.Math.Difference * @since 3.0.0 * - * @param {number} a - [description] - * @param {number} b - [description] + * @param {number} a - The first number in the calculation. + * @param {number} b - The second number in the calculation. * - * @return {number} [description] + * @return {number} The positive difference of the two given numbers. */ var Difference = function (a, b) { diff --git a/src/math/Factorial.js b/src/math/Factorial.js index 7b3700c45..02a0c6c3e 100644 --- a/src/math/Factorial.js +++ b/src/math/Factorial.js @@ -5,14 +5,14 @@ */ /** - * [description] + * Calculates the factorial of a given number for integer values greater than 0. * * @function Phaser.Math.Factorial * @since 3.0.0 * - * @param {number} value - [description] + * @param {number} value - A positive integer to calculate the factorial of. * - * @return {number} [description] + * @return {number} The factorial of the given number. */ var Factorial = function (value) { diff --git a/src/math/FloatBetween.js b/src/math/FloatBetween.js index c57101cc3..78943ddc4 100644 --- a/src/math/FloatBetween.js +++ b/src/math/FloatBetween.js @@ -5,15 +5,15 @@ */ /** - * [description] + * Generate a random floating point number between the two given bounds, minimum inclusive, maximum exclusive. * * @function Phaser.Math.FloatBetween * @since 3.0.0 * - * @param {float} min - [description] - * @param {float} max - [description] + * @param {float} min - The lower bound for the float, inclusive. + * @param {float} max - The upper bound for the float exclusive. * - * @return {float} [description] + * @return {float} A random float within the given range. */ var FloatBetween = function (min, max) { diff --git a/src/scene/GetPhysicsPlugins.js b/src/scene/GetPhysicsPlugins.js index 7b758849a..1125500b9 100644 --- a/src/scene/GetPhysicsPlugins.js +++ b/src/scene/GetPhysicsPlugins.js @@ -13,9 +13,9 @@ var UppercaseFirst = require('../utils/string/UppercaseFirst'); * @function Phaser.Scenes.GetPhysicsPlugins * @since 3.0.0 * - * @param {Phaser.Scenes.Systems} sys - [description] + * @param {Phaser.Scenes.Systems} sys - The scene system to get the physics systems of. * - * @return {array} [description] + * @return {array} An array of Physics systems to start for this Scene. */ var GetPhysicsPlugins = function (sys) {