Class: EmitterOp

Phaser.GameObjects.Particles. EmitterOp

A Particle Emitter property.

Facilitates changing Particle properties as they are emitted and throughout their lifetime.


new EmitterOp(config, key, defaultValue [, emitOnly])

Parameters:
Name Type Argument Default Description
config ParticleEmitterConfig

Settings for the Particle Emitter that owns this property.

key string

The name of the property.

defaultValue number

The default value of the property.

emitOnly boolean <optional>
false

Whether the property can only be modified when a Particle is emitted.

Since: 3.0.0
Source: src/gameobjects/particles/EmitterOp.js (Line 91)

Members


counter :number

The step counter for stepped easing, per emit.

Type:
  • number
Since: 3.0.0
Default Value:
  • 0
Source: src/gameobjects/particles/EmitterOp.js (Line 156)

defaultValue :number

The default value of this property.

Type:
  • number
Since: 3.0.0
Source: src/gameobjects/particles/EmitterOp.js (Line 136)

<nullable> ease :function

The easing function to use for updating this property.

Type:
  • function
Since: 3.0.0
Source: src/gameobjects/particles/EmitterOp.js (Line 186)

emitOnly :boolean

Whether this property can only be modified when a Particle is emitted.

Set to true to allow only Phaser.GameObjects.Particles.EmitterOp#onEmit callbacks to be set and
affect this property.

Set to false to allow both Phaser.GameObjects.Particles.EmitterOp#onEmit and
Phaser.GameObjects.Particles.EmitterOp#onUpdate callbacks to be set and affect this property.

Type:
  • boolean
Since: 3.0.0
Source: src/gameobjects/particles/EmitterOp.js (Line 195)

end :number

The end value for this property to ease between.

Type:
  • number
Since: 3.0.0
Default Value:
  • 0
Source: src/gameobjects/particles/EmitterOp.js (Line 176)

onEmit :EmitterOpOnEmitCallback

The callback to run for Particles when they are emitted from the Particle Emitter.

Type:
Since: 3.0.0
Source: src/gameobjects/particles/EmitterOp.js (Line 210)

onUpdate :EmitterOpOnUpdateCallback

The callback to run for Particles when they are updated.

Type:
Since: 3.0.0
Source: src/gameobjects/particles/EmitterOp.js (Line 219)

propertyKey :string

The name of this property.

Type:
  • string
Since: 3.0.0
Source: src/gameobjects/particles/EmitterOp.js (Line 118)

propertyValue :number

The value of this property.

Type:
  • number
Since: 3.0.0
Source: src/gameobjects/particles/EmitterOp.js (Line 127)

start :number

The start value for this property to ease between.

Type:
  • number
Since: 3.0.0
Default Value:
  • 0
Source: src/gameobjects/particles/EmitterOp.js (Line 166)

steps :number

The number of steps for stepped easing between Phaser.GameObjects.Particles.EmitterOp#start and
Phaser.GameObjects.Particles.EmitterOp#end values, per emit.

Type:
  • number
Since: 3.0.0
Default Value:
  • 0
Source: src/gameobjects/particles/EmitterOp.js (Line 145)

Methods


defaultEmit(particle, key [, value])

The returned value sets what the property will be at the START of the particles life, on emit.

Parameters:
Name Type Argument Description
particle Phaser.GameObjects.Particles.Particle

The particle.

key string

The name of the property.

value number <optional>

The current value of the property.

Since: 3.0.0
Source: src/gameobjects/particles/EmitterOp.js (Line 494)
Returns:

The new value of hte property.

Type
number

defaultUpdate(particle, key, t, value)

The returned value updates the property for the duration of the particles life.

Parameters:
Name Type Description
particle Phaser.GameObjects.Particles.Particle

The particle.

key string

The name of the property.

t number

The T value (between 0 and 1)

value number

The current value of the property.

Since: 3.0.0
Source: src/gameobjects/particles/EmitterOp.js (Line 511)
Returns:

The new value of the property.

Type
number

easedValueEmit(particle, key)

An onEmit callback that returns an eased value between the
Phaser.GameObjects.Particles.EmitterOp#start and Phaser.GameObjects.Particles.EmitterOp#end
range.

Parameters:
Name Type Description
particle Phaser.GameObjects.Particles.Particle

The particle.

key string

The name of the property.

Since: 3.0.0
Source: src/gameobjects/particles/EmitterOp.js (Line 615)
Returns:

The new value of the property.

Type
number

easeValueUpdate(particle, key, t)

An onUpdate callback that returns an eased value between the
Phaser.GameObjects.Particles.EmitterOp#start and Phaser.GameObjects.Particles.EmitterOp#end
range.

Parameters:
Name Type Description
particle Phaser.GameObjects.Particles.Particle

The particle.

key string

The name of the property.

t number

The T value (between 0 and 1)

Since: 3.0.0
Source: src/gameobjects/particles/EmitterOp.js (Line 641)
Returns:

The new value of the property.

Type
number

has(object, key)

Check whether an object has the given property.

Parameters:
Name Type Description
object object

The object to check.

key string

The key of the property to look for in the object.

Since: 3.0.0
Source: src/gameobjects/particles/EmitterOp.js (Line 444)
Returns:

true if the property exists in the object, false otherwise.

Type
boolean

hasBoth(object, key1, key2)

Check whether an object has both of the given properties.

Parameters:
Name Type Description
object object

The object to check.

key1 string

The key of the first property to check the object for.

key2 string

The key of the second property to check the object for.

Since: 3.0.0
Source: src/gameobjects/particles/EmitterOp.js (Line 460)
Returns:

true if both properties exist in the object, false otherwise.

Type
boolean

hasEither(object, key1, key2)

Check whether an object has at least one of the given properties.

Parameters:
Name Type Description
object object

The object to check.

key1 string

The key of the first property to check the object for.

key2 string

The key of the second property to check the object for.

Since: 3.0.0
Source: src/gameobjects/particles/EmitterOp.js (Line 477)
Returns:

true if at least one of the properties exists in the object, false if neither exist.

Type
boolean

loadConfig( [config] [, newKey])

Load the property from a Particle Emitter configuration object.

Optionally accepts a new property key to use, replacing the current one.

Parameters:
Name Type Argument Description
config ParticleEmitterConfig <optional>

Settings for the Particle Emitter that owns this property.

newKey string <optional>

The new key to use for this property, if any.

Since: 3.0.0
Source: src/gameobjects/particles/EmitterOp.js (Line 231)

onChange(value)

Change the current value of the property and update its callback methods.

Parameters:
Name Type Description
value number

The value of the property.

Since: 3.0.0
Source: src/gameobjects/particles/EmitterOp.js (Line 282)
Returns:

This Emitter Op object.

Type
Phaser.GameObjects.Particles.EmitterOp

randomRangedValueEmit(particle, key)

An onEmit callback that returns a value between the Phaser.GameObjects.Particles.EmitterOp#start and
Phaser.GameObjects.Particles.EmitterOp#end range.

Parameters:
Name Type Description
particle Phaser.GameObjects.Particles.Particle

The particle.

key string

The key of the property.

Since: 3.0.0
Source: src/gameobjects/particles/EmitterOp.js (Line 570)
Returns:

The new value of the property.

Type
number

randomStaticValueEmit()

An onEmit callback that returns a random value from the current value array.

Since: 3.0.0
Source: src/gameobjects/particles/EmitterOp.js (Line 555)
Returns:

The new value of the property.

Type
number

setMethods()

Since: 3.0.0
Source: src/gameobjects/particles/EmitterOp.js (Line 299)
Returns:

This Emitter Op object.

Type
Phaser.GameObjects.Particles.EmitterOp

staticValueEmit()

An onEmit callback that returns the current value of the property.

Since: 3.0.0
Source: src/gameobjects/particles/EmitterOp.js (Line 529)
Returns:

The current value of the property.

Type
number

staticValueUpdate()

An onUpdate callback that returns the current value of the property.

Since: 3.0.0
Source: src/gameobjects/particles/EmitterOp.js (Line 542)
Returns:

The current value of the property.

Type
number

steppedEmit()

An onEmit callback that returns a stepped value between the
Phaser.GameObjects.Particles.EmitterOp#start and Phaser.GameObjects.Particles.EmitterOp#end
range.

Since: 3.0.0
Source: src/gameobjects/particles/EmitterOp.js (Line 594)
Returns:

The new value of the property.

Type
number

toJSON()

Build a JSON representation of this Particle Emitter property.

Since: 3.0.0
Source: src/gameobjects/particles/EmitterOp.js (Line 269)
Returns:

A JSON representation of this Particle Emitter property.

Type
object