From 0b881e9a4e3241d4b12272dd3974e928b6e44cf6 Mon Sep 17 00:00:00 2001 From: samme Date: Wed, 18 Apr 2018 08:32:03 -0700 Subject: [PATCH 01/12] Add particles docs --- src/gameobjects/particles/EmitterOp.js | 97 ++- src/gameobjects/particles/Particle.js | 13 +- src/gameobjects/particles/ParticleEmitter.js | 568 +++++++++++------- .../particles/ParticleEmitterManager.js | 78 +-- src/gameobjects/particles/zones/DeathZone.js | 19 +- src/gameobjects/particles/zones/EdgeZone.js | 30 +- src/gameobjects/particles/zones/RandomZone.js | 25 +- 7 files changed, 554 insertions(+), 276 deletions(-) diff --git a/src/gameobjects/particles/EmitterOp.js b/src/gameobjects/particles/EmitterOp.js index 805325248..bb67961ac 100644 --- a/src/gameobjects/particles/EmitterOp.js +++ b/src/gameobjects/particles/EmitterOp.js @@ -11,26 +11,95 @@ 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 a value or an operation yielding a value, setting what a particle property will be at the START of the particle's life, on emit. + * @typedef {float|float[]|EmitterOpOnEmitCallback|EmitterOpRandomConfig|EmitterOpRandomMinMaxConfig|EmitterOpRandomStartEndConfig|EmitterOpSteppedConfig|EmitterOpCustomEmitConfig} EmitterOpEmitConfig + * + * @see Phaser.GameObjects.Particles.Particle#fire + */ + +/** + * Defines an operation yielding a value, updating a particle property for the duration of the particle's life. + * @typedef {EmitterOpOnUpdateCallback|EmitterOpEaseConfig|EmitterOpCustomUpdateConfig} EmitterOpUpdateConfig + * + * @see Phaser.GameObjects.Particles.Particle#update + */ + +/** + * 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 +316,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 +396,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 +406,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 1f84b124e..657319574 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 {EmitterOpEmitConfig} [accelerationX] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#accelerationX} (emit only). + * @property {EmitterOpEmitConfig} [accelerationY] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#accelerationY} (emit only). + * @property {EmitterOpEmitConfig|EmitterOpUpdateConfig} [alpha] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#alpha}. + * @property {EmitterOpEmitConfig} [angle] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#angle} (emit only) + * @property {EmitterOpEmitConfig} [bounce] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#bounce} (emit only). + * @property {EmitterOpEmitConfig} [delay] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#delay} (emit only). + * @property {EmitterOpEmitConfig} [lifespan] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#lifespan} (emit only). + * @property {EmitterOpEmitConfig} [maxVelocityX] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#maxVelocityX} (emit only). + * @property {EmitterOpEmitConfig} [maxVelocityY] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#maxVelocityY} (emit only). + * @property {EmitterOpEmitConfig} [moveToX] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#moveToX} (emit only). + * @property {EmitterOpEmitConfig} [moveToY] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#moveToY} (emit only). + * @property {EmitterOpEmitConfig} [quantity] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#quantity} (emit only). + * @property {EmitterOpEmitConfig|EmitterOpUpdateConfig} [rotate] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#rotate}. + * @property {EmitterOpEmitConfig|EmitterOpUpdateConfig} [scale] - As {@link Phaser.GameObjects.Particles.ParticleEmitter#setScale}. + * @property {EmitterOpEmitConfig|EmitterOpUpdateConfig} [scaleX] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#scaleX}. + * @property {EmitterOpEmitConfig|EmitterOpUpdateConfig} [scaleY] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#scaleY}. + * @property {EmitterOpEmitConfig} [speed] - As {@link Phaser.GameObjects.Particles.ParticleEmitter#setSpeed} (emit only). + * @property {EmitterOpEmitConfig} [speedX] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#speedX} (emit only). + * @property {EmitterOpEmitConfig} [speedY] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#speedY} (emit only). + * @property {EmitterOpEmitConfig} [tint] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#tint}. + * @property {EmitterOpEmitConfig} [x] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#x} (emit only). + * @property {EmitterOpEmitConfig} [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 @@ -48,7 +161,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({ @@ -72,7 +185,7 @@ var ParticleEmitter = new Class({ this.manager = manager; /** - * [description] + * The texture assigned to particles. * * @name Phaser.GameObjects.Particles.ParticleEmitter#texture * @type {Phaser.Textures.Texture} @@ -81,7 +194,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[]} @@ -90,7 +203,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} @@ -99,7 +212,7 @@ var ParticleEmitter = new Class({ this.defaultFrame = manager.defaultFrame; /** - * [description] + * Names of simple configuration properties. * * @name Phaser.GameObjects.Particles.ParticleEmitter#configFastMap * @type {object} @@ -132,7 +245,7 @@ var ParticleEmitter = new Class({ ]; /** - * [description] + * Names of complex configuration properties. * * @name Phaser.GameObjects.Particles.ParticleEmitter#configOpMap * @type {object} @@ -161,7 +274,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. * @@ -177,31 +290,34 @@ 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 */ 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 */ 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 @@ -212,27 +328,27 @@ var ParticleEmitter = new Class({ 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 */ 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 */ this.gravityY = 0; /** - * [description] + * Whether accelerationX and accelerationY are nonzero. Set automatically during configuration. * * @name Phaser.GameObjects.Particles.ParticleEmitter#acceleration * @type {boolean} @@ -242,67 +358,67 @@ 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 */ 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 */ 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} @@ -312,105 +428,107 @@ 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 */ 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 */ 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 */ 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 */ 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 */ 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} @@ -420,7 +538,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 {?*} @@ -430,7 +548,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} @@ -440,7 +558,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 {?*} @@ -454,17 +572,17 @@ 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 */ @@ -474,27 +592,30 @@ 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} puts the emitter in flow mode (frequency >= 0). + * Calling {@link Phaser.GameObjects.Particles.ParticleEmitter#explode} puts the emitter in explode mode (frequency -1). * * @name Phaser.GameObjects.Particles.ParticleEmitter#frequency - * @type {number} + * @type {float} * @default 0 * @since 3.0.0 */ this.frequency = 0; /** - * Controls if the emitter is currently emitting particles. + * Controls if the emitter is currently emitting a particle flow (when frequency > -1). * 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} @@ -515,37 +636,37 @@ 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 */ 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.EdgeZone|Phaser.GameObjects.Particles.Zones.RandomZone} * @default null * @since 3.0.0 */ this.deathZone = null; /** - * [description] + * A rectangular boundary constraining particle movement. * * @name Phaser.GameObjects.Particles.ParticleEmitter#bounds * @type {?Phaser.Geom.Rectangle} @@ -555,7 +676,7 @@ var ParticleEmitter = new Class({ 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} @@ -565,7 +686,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} @@ -575,7 +696,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} @@ -585,7 +706,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} @@ -595,7 +716,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} @@ -605,7 +729,7 @@ 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} @@ -615,7 +739,7 @@ var ParticleEmitter = new Class({ this.visible = true; /** - * [description] + * The blend mode of this emitter's particles. * * @name Phaser.GameObjects.Particles.ParticleEmitter#blendMode * @type {integer} @@ -624,17 +748,17 @@ var ParticleEmitter = new Class({ 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 */ 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} @@ -643,7 +767,8 @@ var ParticleEmitter = new Class({ 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} @@ -653,17 +778,17 @@ var ParticleEmitter = new Class({ this.trackVisible = false; /** - * [description] + * The current texture frame applied to emitted particles. * * @name Phaser.GameObjects.Particles.ParticleEmitter#currentFrame - * @type {number} + * @type {integer} * @default 0 * @since 3.0.0 */ this.currentFrame = 0; /** - * [description] + * Whether texture {@link Phaser.GameObjects.Particles.ParticleEmitter#frames} are selected at random. * * @name Phaser.GameObjects.Particles.ParticleEmitter#randomFrame * @type {boolean} @@ -673,17 +798,17 @@ var ParticleEmitter = new Class({ 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 */ this.frameQuantity = 1; /** - * [description] + * Inactive particles. * * @name Phaser.GameObjects.Particles.ParticleEmitter#dead * @type {Phaser.GameObjects.Particles.Particle[]} @@ -693,7 +818,7 @@ var ParticleEmitter = new Class({ this.dead = []; /** - * [description] + * Active particles * * @name Phaser.GameObjects.Particles.ParticleEmitter#alive * @type {Phaser.GameObjects.Particles.Particle[]} @@ -703,10 +828,10 @@ var ParticleEmitter = new Class({ this.alive = []; /** - * [description] + * The time until the next flow emission is due. * * @name Phaser.GameObjects.Particles.ParticleEmitter#_counter - * @type {number} + * @type {float} * @private * @default 0 * @since 3.0.0 @@ -714,10 +839,10 @@ var ParticleEmitter = new Class({ this._counter = 0; /** - * [description] + * Tracks texture frame allocations. * * @name Phaser.GameObjects.Particles.ParticleEmitter#_frameCounter - * @type {number} + * @type {integer} * @private * @default 0 * @since 3.0.0 @@ -731,12 +856,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. */ @@ -784,7 +909,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; @@ -835,14 +960,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) { @@ -885,15 +1010,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. */ @@ -911,7 +1036,7 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Stops following a Game Object. * * @method Phaser.GameObjects.Particles.ParticleEmitter#stopFollow * @since 3.0.0 @@ -928,12 +1053,12 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Choose 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 () { @@ -968,14 +1093,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. */ @@ -1025,12 +1150,12 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Turns the {@link Phaser.GameObjects.Particles.ParticleEmitter#radial} emission mode 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. */ @@ -1044,13 +1169,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 {EmitterOpEmitConfig} x - The x-coordinate of the particle origin. + * @param {EmitterOpEmitConfig} y - The y-coordinate of the particle origin. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1063,15 +1189,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. */ @@ -1100,12 +1228,12 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Sets the initial horizontal speed of emitted particles. * * @method Phaser.GameObjects.Particles.ParticleEmitter#setSpeedX * @since 3.0.0 * - * @param {number} value - [description] + * @param {EmitterOpEmitConfig} value - The speed, in pixels per second. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1120,12 +1248,12 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Sets the initial vertical speed of emitted particles. * * @method Phaser.GameObjects.Particles.ParticleEmitter#setSpeedY * @since 3.0.0 * - * @param {number} value - [description] + * @param {EmitterOpEmitConfig} value - The speed, in pixels per second. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1143,12 +1271,12 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Sets the initial radial speed of emitted particles. * * @method Phaser.GameObjects.Particles.ParticleEmitter#setSpeed * @since 3.0.0 * - * @param {number} value - [description] + * @param {EmitterOpEmitConfig} value - The speed, in pixels per second. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1164,12 +1292,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 {EmitterOpEmitConfig|EmitterOpUpdateConfig} value - The scale, relative to 1. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1181,12 +1309,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 {EmitterOpEmitConfig|EmitterOpUpdateConfig} value - The scale, relative to 1. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1198,12 +1326,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 {EmitterOpEmitConfig|EmitterOpUpdateConfig} value - The scale, relative to 1. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1216,12 +1344,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. */ @@ -1233,12 +1361,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. */ @@ -1250,13 +1378,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. */ @@ -1269,12 +1397,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 {EmitterOpEmitConfig|EmitterOpUpdateConfig} value - A value between 0 (transparent) and 1 (opaque). * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1286,12 +1414,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 {EmitterOpEmitConfig} value - The angle of the initial velocity of emitted particles. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1303,12 +1431,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 {EmitterOpEmitConfig} value - The angle of the initial velocity of emitted particles. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1320,12 +1448,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 {EmitterOpEmitConfig} value - The particle lifespan, in ms. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1337,12 +1465,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 {EmitterOpEmitConfig} quantity - The number of particles to release at each flow cycle or explosion. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1354,13 +1482,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 {EmitterOpEmitConfig} [quantity] - The number of particles to release at each flow cycle or explosion. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1379,13 +1508,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}. + * + * When `source.type` is 'edge', `source` must have a function `getPoints(quantity, stepRate)` that returns an array of points. + * + * When `source.type` is 'random' (or omitted), `source` must have a function `getRandomPoint(point)` that modifies its argument. * * @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. */ @@ -1404,6 +1536,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) @@ -1432,12 +1569,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 {object} [ParticleEmitterDeathZoneConfig] - An object describing the zone, or `undefined` to remove any current death zone. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1468,12 +1605,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. */ @@ -1490,12 +1627,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 () { @@ -1503,12 +1640,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 () { @@ -1516,12 +1653,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 () { @@ -1529,7 +1666,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 @@ -1542,13 +1679,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. */ @@ -1574,13 +1711,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. */ @@ -1606,7 +1743,7 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Deactivates every particle in this emitter. * * @method Phaser.GameObjects.Particles.ParticleEmitter#killAll * @since 3.0.0 @@ -1627,13 +1764,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. */ @@ -1652,13 +1789,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. */ @@ -1677,7 +1814,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 @@ -1694,7 +1836,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 @@ -1709,7 +1851,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 @@ -1724,7 +1866,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 @@ -1739,13 +1881,13 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Starts (or restarts) a particle flow. * * @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 {EmitterOpEmitConfig} [count=1] - The number of particles to emit at each flow cycle. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1761,14 +1903,14 @@ var ParticleEmitter = new Class({ }, /** - * [description] + * Stops 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. */ @@ -1780,14 +1922,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. */ @@ -1797,16 +1939,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) { @@ -1861,13 +2005,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) { @@ -1952,15 +2096,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) { @@ -1968,15 +2112,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..1c95a53aa 100644 --- a/src/gameobjects/particles/zones/DeathZone.js +++ b/src/gameobjects/particles/zones/DeathZone.js @@ -6,6 +6,21 @@ 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 + */ + /** * @classdesc * A Death Zone. @@ -20,7 +35,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 +49,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; From 8b939d7790928fd1b6303bf2f777c1b2e58a0e5e Mon Sep 17 00:00:00 2001 From: samme Date: Fri, 20 Apr 2018 06:51:31 -0700 Subject: [PATCH 02/12] Omit EmitterOpEmitConfig, EmitterOpUpdateConfig --- src/gameobjects/particles/EmitterOp.js | 14 ---- src/gameobjects/particles/ParticleEmitter.js | 74 ++++++++++---------- 2 files changed, 37 insertions(+), 51 deletions(-) diff --git a/src/gameobjects/particles/EmitterOp.js b/src/gameobjects/particles/EmitterOp.js index bb67961ac..0a7588741 100644 --- a/src/gameobjects/particles/EmitterOp.js +++ b/src/gameobjects/particles/EmitterOp.js @@ -33,20 +33,6 @@ var Wrap = require('../../math/Wrap'); * @return {number} The new value of the property. */ -/** - * Defines a value or an operation yielding a value, setting what a particle property will be at the START of the particle's life, on emit. - * @typedef {float|float[]|EmitterOpOnEmitCallback|EmitterOpRandomConfig|EmitterOpRandomMinMaxConfig|EmitterOpRandomStartEndConfig|EmitterOpSteppedConfig|EmitterOpCustomEmitConfig} EmitterOpEmitConfig - * - * @see Phaser.GameObjects.Particles.Particle#fire - */ - -/** - * Defines an operation yielding a value, updating a particle property for the duration of the particle's life. - * @typedef {EmitterOpOnUpdateCallback|EmitterOpEaseConfig|EmitterOpCustomUpdateConfig} EmitterOpUpdateConfig - * - * @see Phaser.GameObjects.Particles.Particle#update - */ - /** * Defines an operation yielding a random value within a range. * @typedef {object} EmitterOpRandomConfig diff --git a/src/gameobjects/particles/ParticleEmitter.js b/src/gameobjects/particles/ParticleEmitter.js index 657319574..f38cd035e 100644 --- a/src/gameobjects/particles/ParticleEmitter.js +++ b/src/gameobjects/particles/ParticleEmitter.js @@ -108,28 +108,28 @@ var Wrap = require('../../math/Wrap'); * @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 {EmitterOpEmitConfig} [accelerationX] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#accelerationX} (emit only). - * @property {EmitterOpEmitConfig} [accelerationY] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#accelerationY} (emit only). - * @property {EmitterOpEmitConfig|EmitterOpUpdateConfig} [alpha] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#alpha}. - * @property {EmitterOpEmitConfig} [angle] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#angle} (emit only) - * @property {EmitterOpEmitConfig} [bounce] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#bounce} (emit only). - * @property {EmitterOpEmitConfig} [delay] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#delay} (emit only). - * @property {EmitterOpEmitConfig} [lifespan] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#lifespan} (emit only). - * @property {EmitterOpEmitConfig} [maxVelocityX] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#maxVelocityX} (emit only). - * @property {EmitterOpEmitConfig} [maxVelocityY] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#maxVelocityY} (emit only). - * @property {EmitterOpEmitConfig} [moveToX] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#moveToX} (emit only). - * @property {EmitterOpEmitConfig} [moveToY] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#moveToY} (emit only). - * @property {EmitterOpEmitConfig} [quantity] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#quantity} (emit only). - * @property {EmitterOpEmitConfig|EmitterOpUpdateConfig} [rotate] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#rotate}. - * @property {EmitterOpEmitConfig|EmitterOpUpdateConfig} [scale] - As {@link Phaser.GameObjects.Particles.ParticleEmitter#setScale}. - * @property {EmitterOpEmitConfig|EmitterOpUpdateConfig} [scaleX] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#scaleX}. - * @property {EmitterOpEmitConfig|EmitterOpUpdateConfig} [scaleY] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#scaleY}. - * @property {EmitterOpEmitConfig} [speed] - As {@link Phaser.GameObjects.Particles.ParticleEmitter#setSpeed} (emit only). - * @property {EmitterOpEmitConfig} [speedX] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#speedX} (emit only). - * @property {EmitterOpEmitConfig} [speedY] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#speedY} (emit only). - * @property {EmitterOpEmitConfig} [tint] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#tint}. - * @property {EmitterOpEmitConfig} [x] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#x} (emit only). - * @property {EmitterOpEmitConfig} [y] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#y} (emit only). + * @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}. @@ -1175,8 +1175,8 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#setPosition * @since 3.0.0 * - * @param {EmitterOpEmitConfig} x - The x-coordinate of the particle origin. - * @param {EmitterOpEmitConfig} y - The y-coordinate of the particle origin. + * @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. */ @@ -1233,7 +1233,7 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#setSpeedX * @since 3.0.0 * - * @param {EmitterOpEmitConfig} value - The speed, in pixels per second. + * @param {float|float[]|EmitterOpOnEmitCallback|object} value - The speed, in pixels per second. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1253,7 +1253,7 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#setSpeedY * @since 3.0.0 * - * @param {EmitterOpEmitConfig} value - The speed, in pixels per second. + * @param {float|float[]|EmitterOpOnEmitCallback|object} value - The speed, in pixels per second. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1276,7 +1276,7 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#setSpeed * @since 3.0.0 * - * @param {EmitterOpEmitConfig} value - The speed, in pixels per second. + * @param {float|float[]|EmitterOpOnEmitCallback|object} value - The speed, in pixels per second. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1297,7 +1297,7 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#setScaleX * @since 3.0.0 * - * @param {EmitterOpEmitConfig|EmitterOpUpdateConfig} value - The scale, relative to 1. + * @param {float|float[]|EmitterOpOnUpdateCallback|object} value - The scale, relative to 1. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1314,7 +1314,7 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#setScaleY * @since 3.0.0 * - * @param {EmitterOpEmitConfig|EmitterOpUpdateConfig} value - The scale, relative to 1. + * @param {float|float[]|EmitterOpOnUpdateCallback|object} value - The scale, relative to 1. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1331,7 +1331,7 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#setScale * @since 3.0.0 * - * @param {EmitterOpEmitConfig|EmitterOpUpdateConfig} value - The scale, relative to 1. + * @param {float|float[]|EmitterOpOnUpdateCallback|object} value - The scale, relative to 1. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1402,7 +1402,7 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#setAlpha * @since 3.0.0 * - * @param {EmitterOpEmitConfig|EmitterOpUpdateConfig} value - A value between 0 (transparent) and 1 (opaque). + * @param {float|float[]|EmitterOpOnUpdateCallback|object} value - A value between 0 (transparent) and 1 (opaque). * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1419,7 +1419,7 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#setEmitterAngle * @since 3.0.0 * - * @param {EmitterOpEmitConfig} value - The angle of the initial velocity of emitted particles. + * @param {float|float[]|EmitterOpOnEmitCallback|object} value - The angle of the initial velocity of emitted particles. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1436,7 +1436,7 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#setAngle * @since 3.0.0 * - * @param {EmitterOpEmitConfig} value - The angle of the initial velocity of emitted particles. + * @param {float|float[]|EmitterOpOnEmitCallback|object} value - The angle of the initial velocity of emitted particles. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1453,7 +1453,7 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#setLifespan * @since 3.0.0 * - * @param {EmitterOpEmitConfig} value - The particle lifespan, in ms. + * @param {float|float[]|EmitterOpOnEmitCallback|object} value - The particle lifespan, in ms. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1470,7 +1470,7 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#setQuantity * @since 3.0.0 * - * @param {EmitterOpEmitConfig} quantity - The number of particles to release at each flow cycle or explosion. + * @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. */ @@ -1489,7 +1489,7 @@ var ParticleEmitter = new Class({ * @since 3.0.0 * * @param {float} frequency - The time interval (>= 0) of each flow cycle, in ms; or -1 to put the emitter in explosion mode. - * @param {EmitterOpEmitConfig} [quantity] - The number of particles to release at each flow cycle or explosion. + * @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. */ @@ -1887,7 +1887,7 @@ var ParticleEmitter = new Class({ * @since 3.0.0 * * @param {float} frequency - The time interval (>= 0) of each flow cycle, in ms. - * @param {EmitterOpEmitConfig} [count=1] - The number of particles to emit at each flow cycle. + * @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. */ From a7fc306329b6c063a73e28fad70e840058497a65 Mon Sep 17 00:00:00 2001 From: Basile Desloges Date: Fri, 20 Apr 2018 14:39:01 +0200 Subject: [PATCH 03/12] Update GetBounds.getBounds() JSDoc so that @generic matches with @param and @return --- src/gameobjects/components/GetBounds.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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. * From 711d2a619362bdd2968ae37c1f18f1f13d79b49a Mon Sep 17 00:00:00 2001 From: samme Date: Fri, 20 Apr 2018 21:00:19 -0700 Subject: [PATCH 04/12] Minor additions and corrections to docs --- src/gameobjects/particles/ParticleEmitter.js | 62 +++++++++++++++----- src/gameobjects/particles/zones/DeathZone.js | 6 ++ 2 files changed, 54 insertions(+), 14 deletions(-) diff --git a/src/gameobjects/particles/ParticleEmitter.js b/src/gameobjects/particles/ParticleEmitter.js index f38cd035e..a02a5fc6c 100644 --- a/src/gameobjects/particles/ParticleEmitter.js +++ b/src/gameobjects/particles/ParticleEmitter.js @@ -302,6 +302,7 @@ var ParticleEmitter = new Class({ * @type {Phaser.GameObjects.Particles.EmitterOp} * @default 0 * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#setPosition */ this.x = new EmitterOp(config, 'x', 0); @@ -312,6 +313,7 @@ var ParticleEmitter = new Class({ * @type {Phaser.GameObjects.Particles.EmitterOp} * @default 0 * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#setPosition */ this.y = new EmitterOp(config, 'y', 0); @@ -324,6 +326,7 @@ var ParticleEmitter = new Class({ * @type {boolean} * @default true * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#setRadial */ this.radial = true; @@ -334,6 +337,7 @@ var ParticleEmitter = new Class({ * @type {float} * @default 0 * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#setGravity */ this.gravityX = 0; @@ -344,6 +348,7 @@ var ParticleEmitter = new Class({ * @type {float} * @default 0 * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#setGravity */ this.gravityY = 0; @@ -404,6 +409,7 @@ var ParticleEmitter = new Class({ * @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); @@ -414,6 +420,7 @@ var ParticleEmitter = new Class({ * @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); @@ -464,6 +471,8 @@ var ParticleEmitter = new Class({ * @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); @@ -474,6 +483,8 @@ var ParticleEmitter = new Class({ * @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); @@ -494,6 +505,7 @@ var ParticleEmitter = new Class({ * @type {Phaser.GameObjects.Particles.EmitterOp} * @default 1 * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#setAlpha */ this.alpha = new EmitterOp(config, 'alpha', 1); @@ -504,6 +516,7 @@ var ParticleEmitter = new Class({ * @type {Phaser.GameObjects.Particles.EmitterOp} * @default 1000 * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#setLifespan */ this.lifespan = new EmitterOp(config, 'lifespan', 1000); @@ -514,6 +527,7 @@ var ParticleEmitter = new Class({ * @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 }); @@ -585,6 +599,8 @@ var ParticleEmitter = new Class({ * @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); @@ -602,18 +618,19 @@ var ParticleEmitter = new Class({ * 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} puts the emitter in flow mode (frequency >= 0). - * Calling {@link Phaser.GameObjects.Particles.ParticleEmitter#explode} puts the emitter in explode mode (frequency -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 {float} * @default 0 * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#setFrequency */ this.frequency = 0; /** - * Controls if the emitter is currently emitting a particle flow (when frequency > -1). + * 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}. * @@ -652,6 +669,7 @@ var ParticleEmitter = new Class({ * @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; @@ -659,9 +677,10 @@ var ParticleEmitter = new Class({ * An object describing a shape that deactivates particles when they interact with it. * * @name Phaser.GameObjects.Particles.ParticleEmitter#deathZone - * @type {?Phaser.GameObjects.Particles.Zones.EdgeZone|Phaser.GameObjects.Particles.Zones.RandomZone} + * @type {?Phaser.GameObjects.Particles.Zones.DeathZone} * @default null * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#setDeathZone */ this.deathZone = null; @@ -672,6 +691,7 @@ var ParticleEmitter = new Class({ * @type {?Phaser.Geom.Rectangle} * @default null * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#setBounds */ this.bounds = null; @@ -735,6 +755,7 @@ var ParticleEmitter = new Class({ * @type {boolean} * @default true * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#setVisible */ this.visible = true; @@ -744,6 +765,7 @@ var ParticleEmitter = new Class({ * @name Phaser.GameObjects.Particles.ParticleEmitter#blendMode * @type {integer} * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#setBlendMode */ this.blendMode = BlendModes.NORMAL; @@ -754,6 +776,8 @@ var ParticleEmitter = new Class({ * @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; @@ -763,6 +787,7 @@ var ParticleEmitter = new Class({ * @name Phaser.GameObjects.Particles.ParticleEmitter#followOffset * @type {Phaser.Math.Vector2} * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#startFollow */ this.followOffset = new Vector2(); @@ -774,16 +799,18 @@ var ParticleEmitter = new Class({ * @type {boolean} * @default false * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#startFollow */ this.trackVisible = false; /** - * The current texture frame applied to emitted particles. + * The current texture frame, as an index of {@link Phaser.GameObjects.Particles.ParticleEmitter#frames}. * * @name Phaser.GameObjects.Particles.ParticleEmitter#currentFrame * @type {integer} * @default 0 * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#setFrame */ this.currentFrame = 0; @@ -794,6 +821,7 @@ var ParticleEmitter = new Class({ * @type {boolean} * @default true * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#setFrame */ this.randomFrame = true; @@ -804,6 +832,7 @@ var ParticleEmitter = new Class({ * @type {integer} * @default 1 * @since 3.0.0 + * @see Phaser.GameObjects.Particles.ParticleEmitter#setFrame */ this.frameQuantity = 1; @@ -828,7 +857,7 @@ var ParticleEmitter = new Class({ this.alive = []; /** - * The time until the next flow emission is due. + * The time until the next flow cycle. * * @name Phaser.GameObjects.Particles.ParticleEmitter#_counter * @type {float} @@ -839,7 +868,7 @@ var ParticleEmitter = new Class({ this._counter = 0; /** - * Tracks texture frame allocations. + * Counts up to {@link Phaser.GameObjects.Particles.ParticleEmitter#frameQuantity}. * * @name Phaser.GameObjects.Particles.ParticleEmitter#_frameCounter * @type {integer} @@ -1053,7 +1082,7 @@ var ParticleEmitter = new Class({ }, /** - * Choose a texture frame from {@link Phaser.GameObjects.Particles.ParticleEmitter#frames}. + * Chooses a texture frame from {@link Phaser.GameObjects.Particles.ParticleEmitter#frames}. * * @method Phaser.GameObjects.Particles.ParticleEmitter#getFrame * @since 3.0.0 @@ -1150,7 +1179,7 @@ var ParticleEmitter = new Class({ }, /** - * Turns the {@link Phaser.GameObjects.Particles.ParticleEmitter#radial} emission mode on or off. + * Turns {@link Phaser.GameObjects.Particles.ParticleEmitter#radial} particle movement on or off. * * @method Phaser.GameObjects.Particles.ParticleEmitter#setRadial * @since 3.0.0 @@ -1229,6 +1258,7 @@ var ParticleEmitter = new Class({ /** * Sets the initial horizontal speed of emitted particles. + * Changes the emitter to point mode. * * @method Phaser.GameObjects.Particles.ParticleEmitter#setSpeedX * @since 3.0.0 @@ -1249,6 +1279,7 @@ var ParticleEmitter = new Class({ /** * Sets the initial vertical speed of emitted particles. + * Changes the emitter to point mode. * * @method Phaser.GameObjects.Particles.ParticleEmitter#setSpeedY * @since 3.0.0 @@ -1272,6 +1303,7 @@ var ParticleEmitter = new Class({ /** * Sets the initial radial speed of emitted particles. + * Changes the emitter to radial mode. * * @method Phaser.GameObjects.Particles.ParticleEmitter#setSpeed * @since 3.0.0 @@ -1510,9 +1542,9 @@ var ParticleEmitter = new Class({ /** * Sets or removes the {@link Phaser.GameObjects.Particles.ParticleEmitter#emitZone}. * - * When `source.type` is 'edge', `source` must have a function `getPoints(quantity, stepRate)` that returns an array of points. + * 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. * - * When `source.type` is 'random' (or omitted), `source` must have a function `getRandomPoint(point)` that modifies its argument. + * 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 @@ -1574,7 +1606,7 @@ var ParticleEmitter = new Class({ * @method Phaser.GameObjects.Particles.ParticleEmitter#setDeathZone * @since 3.0.0 * - * @param {object} [ParticleEmitterDeathZoneConfig] - An object describing the zone, or `undefined` to remove any current death zone. + * @param {ParticleEmitterDeathZoneConfig} [zoneConfig] - An object describing the zone, or `undefined` to remove any current death zone. * * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. */ @@ -1881,7 +1913,9 @@ var ParticleEmitter = new Class({ }, /** - * Starts (or restarts) a particle flow. + * 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 @@ -1903,7 +1937,7 @@ var ParticleEmitter = new Class({ }, /** - * Stops any current particle flow and emits several particles all at once. + * 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 diff --git a/src/gameobjects/particles/zones/DeathZone.js b/src/gameobjects/particles/zones/DeathZone.js index 1c95a53aa..a5418cf38 100644 --- a/src/gameobjects/particles/zones/DeathZone.js +++ b/src/gameobjects/particles/zones/DeathZone.js @@ -19,6 +19,12 @@ var Class = require('../../../utils/Class'); * @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 */ /** From 2c584d3d0ef85a1c12586ed60f8216719e3af678 Mon Sep 17 00:00:00 2001 From: Daniel <24710205+Fabadiculous@users.noreply.github.com> Date: Sun, 22 Apr 2018 16:50:09 +1000 Subject: [PATCH 05/12] Fill all description tags in GetPhysicsPlugins.js --- src/scene/GetPhysicsPlugins.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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) { From d7c5d8951a03d04683e88e28496b50ae0b5df995 Mon Sep 17 00:00:00 2001 From: Daniel <24710205+Fabadiculous@users.noreply.github.com> Date: Sun, 22 Apr 2018 16:53:35 +1000 Subject: [PATCH 06/12] Fill all description tags for Phaser.Math.Factorial --- src/math/FloatBetween.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/math/FloatBetween.js b/src/math/FloatBetween.js index c57101cc3..0d059a74b 100644 --- a/src/math/FloatBetween.js +++ b/src/math/FloatBetween.js @@ -5,15 +5,15 @@ */ /** - * [description] + * Generate a random floating point number between the given maximum and minimum bounds with the minimum bound inclusive, maximum bound exclusive. * * @function Phaser.Math.FloatBetween * @since 3.0.0 * - * @param {float} min - [description] - * @param {float} max - [description] + * @param {float} min - The minimum bound of the generated float (inclusive). + * @param {float} max - The maximum bound of the generated float (exclusive). * - * @return {float} [description] + * @return {float} The randomly generated float. */ var FloatBetween = function (min, max) { From 9701d68af2edc00df55f9e6eb78bd0172b2da951 Mon Sep 17 00:00:00 2001 From: Daniel <24710205+Fabadiculous@users.noreply.github.com> Date: Sun, 22 Apr 2018 16:59:25 +1000 Subject: [PATCH 07/12] Fill all description tags for Phaser.Math.FloatBetween --- src/math/FloatBetween.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/math/FloatBetween.js b/src/math/FloatBetween.js index 0d059a74b..c57101cc3 100644 --- a/src/math/FloatBetween.js +++ b/src/math/FloatBetween.js @@ -5,15 +5,15 @@ */ /** - * Generate a random floating point number between the given maximum and minimum bounds with the minimum bound inclusive, maximum bound exclusive. + * [description] * * @function Phaser.Math.FloatBetween * @since 3.0.0 * - * @param {float} min - The minimum bound of the generated float (inclusive). - * @param {float} max - The maximum bound of the generated float (exclusive). + * @param {float} min - [description] + * @param {float} max - [description] * - * @return {float} The randomly generated float. + * @return {float} [description] */ var FloatBetween = function (min, max) { From ea1d01b3259f405d434b4943e582ffdafd022b13 Mon Sep 17 00:00:00 2001 From: Daniel <24710205+Fabadiculous@users.noreply.github.com> Date: Sun, 22 Apr 2018 16:59:44 +1000 Subject: [PATCH 08/12] Fill all description tags for Phaser.Math.Factorial --- src/math/Factorial.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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) { From d67559debc4e62fdea315c303b104dd693611d33 Mon Sep 17 00:00:00 2001 From: Daniel <24710205+Fabadiculous@users.noreply.github.com> Date: Sun, 22 Apr 2018 17:00:03 +1000 Subject: [PATCH 09/12] Fill all description tags for Phaser.Math.Difference --- src/math/Difference.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/math/Difference.js b/src/math/Difference.js index fe261f713..4d265fd39 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) { From 0a422fce0cfb31b52711d1511b6d37648f07f173 Mon Sep 17 00:00:00 2001 From: Daniel <24710205+Fabadiculous@users.noreply.github.com> Date: Sun, 22 Apr 2018 17:03:47 +1000 Subject: [PATCH 10/12] Add full stops at the end of doc sentences --- src/math/Difference.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/math/Difference.js b/src/math/Difference.js index 4d265fd39..4e39dd497 100644 --- a/src/math/Difference.js +++ b/src/math/Difference.js @@ -13,7 +13,7 @@ * @param {number} a - The first number in the calculation. * @param {number} b - The second number in the calculation. * - * @return {number} The positive difference of the two given numbers + * @return {number} The positive difference of the two given numbers. */ var Difference = function (a, b) { From 0e3c1064c94d49e4cf04ae4b1a93f3cd9c017fdd Mon Sep 17 00:00:00 2001 From: Daniel <24710205+Fabadiculous@users.noreply.github.com> Date: Sun, 22 Apr 2018 17:04:11 +1000 Subject: [PATCH 11/12] Actually fill in the doc tags, instead of commiting the wrong thing --- src/math/FloatBetween.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/math/FloatBetween.js b/src/math/FloatBetween.js index c57101cc3..7fd08ded4 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) { From 96d1b691fafbe5d3b4194ce2d37e28a36dcc9cdf Mon Sep 17 00:00:00 2001 From: Daniel <24710205+Fabadiculous@users.noreply.github.com> Date: Sun, 22 Apr 2018 17:07:55 +1000 Subject: [PATCH 12/12] Add full stop to docs --- src/math/FloatBetween.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/math/FloatBetween.js b/src/math/FloatBetween.js index 7fd08ded4..78943ddc4 100644 --- a/src/math/FloatBetween.js +++ b/src/math/FloatBetween.js @@ -13,7 +13,7 @@ * @param {float} min - The lower bound for the float, inclusive. * @param {float} max - The upper bound for the float exclusive. * - * @return {float} A random float within the given range + * @return {float} A random float within the given range. */ var FloatBetween = function (min, max) {