Skip to content

Commit 584e8f9

Browse files
committed
Started documenting the EmitterOp class.
1 parent 92d06d4 commit 584e8f9

1 file changed

Lines changed: 39 additions & 35 deletions

File tree

src/gameobjects/particles/EmitterOp.js

Lines changed: 39 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ var Wrap = require('../../math/Wrap');
2727
*
2828
* @param {Phaser.GameObjects.Particles.Particle} particle - The particle.
2929
* @param {string} key - The name of the property.
30-
* @param {float} t - The normalized lifetime of the particle, between 0 (start) and 1 (end).
30+
* @param {number} t - The normalized lifetime of the particle, between 0 (start) and 1 (end).
3131
* @param {number} value - The current value of the property.
3232
*
3333
* @return {number} The new value of the property.
@@ -37,32 +37,32 @@ var Wrap = require('../../math/Wrap');
3737
* Defines an operation yielding a random value within a range.
3838
* @typedef {object} EmitterOpRandomConfig
3939
*
40-
* @property {float[]} random - The minimum and maximum values, as [min, max].
40+
* @property {number[]} random - The minimum and maximum values, as [min, max].
4141
*/
4242

4343
/**
4444
* Defines an operation yielding a random value within a range.
4545
* @typedef {object} EmitterOpRandomMinMaxConfig
4646
*
47-
* @property {float} min - The minimum value.
48-
* @property {float} max - The maximum value.
47+
* @property {number} min - The minimum value.
48+
* @property {number} max - The maximum value.
4949
*/
5050

5151
/**
5252
* Defines an operation yielding a random value within a range.
5353
* @typedef {object} EmitterOpRandomStartEndConfig
5454
*
55-
* @property {float} start - The starting value.
56-
* @property {float} end - The ending value.
55+
* @property {number} start - The starting value.
56+
* @property {number} end - The ending value.
5757
* @property {boolean} random - If false, this becomes {@link EmitterOpEaseConfig}.
5858
*/
5959

6060
/**
6161
* Defines an operation yielding a value incremented continuously across a range.
6262
* @typedef {object} EmitterOpEaseConfig
6363
*
64-
* @property {float} start - The starting value.
65-
* @property {float} end - The ending value.
64+
* @property {number} start - The starting value.
65+
* @property {number} end - The ending value.
6666
* @property {string} [ease='Linear'] - The name of the easing function.
6767
*/
6868

@@ -90,16 +90,18 @@ var Wrap = require('../../math/Wrap');
9090

9191
/**
9292
* @classdesc
93-
* [description]
93+
* A Particle Emitter property.
94+
*
95+
* Facilitates changing Particle properties as they are emitted and throughout their lifetime.
9496
*
9597
* @class EmitterOp
9698
* @memberOf Phaser.GameObjects.Particles
9799
* @constructor
98100
* @since 3.0.0
99101
*
100-
* @param {object} config - [description]
101-
* @param {string} key - [description]
102-
* @param {number} defaultValue - [description]
102+
* @param {ParticleEmitterConfig} config - Settings for the Particle Emitter that owns this property.
103+
* @param {string} key - The key of the Particle Emitter property.
104+
* @param {number} defaultValue - The default value of the Particle Emitter property.
103105
* @param {boolean} [emitOnly=false] - [description]
104106
*/
105107
var EmitterOp = new Class({
@@ -114,7 +116,7 @@ var EmitterOp = new Class({
114116
}
115117

116118
/**
117-
* [description]
119+
* The key of this Particle Emitter property.
118120
*
119121
* @name Phaser.GameObjects.Particles.EmitterOp#propertyKey
120122
* @type {string}
@@ -123,7 +125,7 @@ var EmitterOp = new Class({
123125
this.propertyKey = key;
124126

125127
/**
126-
* [description]
128+
* The value of this Particle Emitter property.
127129
*
128130
* @name Phaser.GameObjects.Particles.EmitterOp#propertyValue
129131
* @type {number}
@@ -132,7 +134,7 @@ var EmitterOp = new Class({
132134
this.propertyValue = defaultValue;
133135

134136
/**
135-
* [description]
137+
* The default value of this Particle Emitter property.
136138
*
137139
* @name Phaser.GameObjects.Particles.EmitterOp#defaultValue
138140
* @type {number}
@@ -220,13 +222,15 @@ var EmitterOp = new Class({
220222
},
221223

222224
/**
223-
* [description]
225+
* Load the property from a Particle Emitter configuration object.
226+
*
227+
* Optionally accepts a new property key to use, replacing the current one.
224228
*
225229
* @method Phaser.GameObjects.Particles.EmitterOp#loadConfig
226230
* @since 3.0.0
227231
*
228-
* @param {object} [config] - [description]
229-
* @param {string} [newKey] - [description]
232+
* @param {ParticleEmitterConfig} [config] - Settings for the Particle Emitter that owns this property.
233+
* @param {string} [newKey] - The new key to use for this property, if any.
230234
*/
231235
loadConfig: function (config, newKey)
232236
{
@@ -256,12 +260,12 @@ var EmitterOp = new Class({
256260
},
257261

258262
/**
259-
* [description]
263+
* Build a JSON representation of this Particle Emitter property.
260264
*
261265
* @method Phaser.GameObjects.Particles.EmitterOp#toJSON
262266
* @since 3.0.0
263267
*
264-
* @return {object} [description]
268+
* @return {object} A JSON representation of this Particle Emitter property.
265269
*/
266270
toJSON: function ()
267271
{
@@ -429,49 +433,49 @@ var EmitterOp = new Class({
429433
},
430434

431435
/**
432-
* [description]
436+
* Check whether an object has the given property.
433437
*
434438
* @method Phaser.GameObjects.Particles.EmitterOp#has
435439
* @since 3.0.0
436440
*
437-
* @param {object} object - [description]
438-
* @param {string} key - [description]
441+
* @param {object} object - The object to check.
442+
* @param {string} key - The key of the property to look for in the object.
439443
*
440-
* @return {boolean} [description]
444+
* @return {boolean} `true` if the property exists in the object, `false` otherwise.
441445
*/
442446
has: function (object, key)
443447
{
444448
return object.hasOwnProperty(key);
445449
},
446450

447451
/**
448-
* [description]
452+
* Check whether an object has both of the given properties.
449453
*
450454
* @method Phaser.GameObjects.Particles.EmitterOp#hasBoth
451455
* @since 3.0.0
452456
*
453-
* @param {object} object - [description]
454-
* @param {string} key1 - [description]
455-
* @param {string} key2 - [description]
457+
* @param {object} object - The object to check.
458+
* @param {string} key1 - The key of the first property to check the object for.
459+
* @param {string} key2 - The key of the second property to check the object for.
456460
*
457-
* @return {boolean} [description]
461+
* @return {boolean} `true` if both properties exist in the object, `false` otherwise.
458462
*/
459463
hasBoth: function (object, key1, key2)
460464
{
461465
return object.hasOwnProperty(key1) && object.hasOwnProperty(key2);
462466
},
463467

464468
/**
465-
* [description]
469+
* Check whether an object has at least one of the given properties.
466470
*
467471
* @method Phaser.GameObjects.Particles.EmitterOp#hasEither
468472
* @since 3.0.0
469473
*
470-
* @param {object} object - [description]
471-
* @param {string} key1 - [description]
472-
* @param {string} key2 - [description]
474+
* @param {object} object - The object to check.
475+
* @param {string} key1 - The key of the first property to check the object for.
476+
* @param {string} key2 - The key of the second property to check the object for.
473477
*
474-
* @return {boolean} [description]
478+
* @return {boolean} `true` if at least one of the properties exists in the object, `false` if neither exist.
475479
*/
476480
hasEither: function (object, key1, key2)
477481
{
@@ -503,7 +507,7 @@ var EmitterOp = new Class({
503507
*
504508
* @param {Phaser.GameObjects.Particles.Particle} particle - [description]
505509
* @param {string} key - [description]
506-
* @param {float} t - The T value (between 0 and 1)
510+
* @param {number} t - The T value (between 0 and 1)
507511
* @param {number} value - [description]
508512
*
509513
* @return {number} [description]

0 commit comments

Comments
 (0)