Phaser API Documentation

  Version: 
Filter

A Particle Emitter property.

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

Constructor:

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

Parameters:

name type arguments Default description
config Phaser.Types.GameObjects.Particles.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

Members

counter: number
Focus
Focus

Description:

The step counter for stepped easing, per emit.

Type:
number
Default: 0
Since: 3.0.0
Focus
Focus
defaultValue: number
Focus
Focus

Description:

The default value of this property.

Type:
number
Since: 3.0.0
Focus
Focus
<nullable> ease: function
Focus
Focus

Description:

The easing function to use for updating this property.

Type:
function
Since: 3.0.0
Focus
Focus
emitOnly: boolean
Focus
Focus

Description:

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
Focus
Focus
end: number
Focus
Focus

Description:

The end value for this property to ease between.

Type:
number
Default: 0
Since: 3.0.0
Focus
Focus

Description:

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

Type:
Since: 3.0.0
Focus
Focus

Description:

The callback to run for Particles when they are updated.

Type:
Since: 3.0.0
Focus
Focus
propertyKey: string
Focus
Focus

Description:

The name of this property.

Type:
string
Since: 3.0.0
Focus
Focus
propertyValue: number
Focus
Focus

Description:

The value of this property.

Type:
number
Since: 3.0.0
Focus
Focus
start: number
Focus
Focus

Description:

The start value for this property to ease between.

Type:
number
Default: 0
Since: 3.0.0
Focus
Focus
steps: number
Focus
Focus

Description:

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

Type:
number
Default: 0
Since: 3.0.0
Focus
Focus

Methods

defaultEmit(particle, key, [value])
Focus
Focus

Description:

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

Parameters:

name type arguments description
particle Phaser.GameObjects.Particles.Particle

The particle.

key string

The name of the property.

value number <optional>

The current value of the property.

Returns:
Description:

The new value of the property.

Type:
  • number
Since: 3.0.0
Focus
Focus
defaultUpdate(particle, key, t, value)
Focus
Focus

Description:

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.

Returns:
Description:

The new value of the property.

Type:
  • number
Since: 3.0.0
Focus
Focus
easeValueUpdate(particle, key, t)
Focus
Focus

Description:

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)

Returns:
Description:

The new value of the property.

Type:
  • number
Since: 3.0.0
Focus
Focus
easedValueEmit(particle, key)
Focus
Focus

Description:

An onEmit callback for an eased property.

It prepares the particle for easing by Phaser.GameObjects.Particles.EmitterOp#easeValueUpdate.

Parameters:

name type description
particle Phaser.GameObjects.Particles.Particle

The particle.

key string

The name of the property.

Returns:
Description:

{@link Phaser.GameObjects.Particles.EmitterOp#start}, as the new value of the property.

Type:
  • number
Since: 3.0.0
Focus
Focus
has(object, key)
Focus
Focus

Description:

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.

Returns:
Description:

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

Type:
  • boolean
Since: 3.0.0
Focus
Focus
hasBoth(object, key1, key2)
Focus
Focus

Description:

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.

Returns:
Description:

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

Type:
  • boolean
Since: 3.0.0
Focus
Focus
hasEither(object, key1, key2)
Focus
Focus

Description:

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.

Returns:
Description:

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

Type:
  • boolean
Since: 3.0.0
Focus
Focus
loadConfig([config], [newKey])
Focus
Focus

Description:

Load the property from a Particle Emitter configuration object.

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

Parameters:

name type arguments description
config Phaser.Types.GameObjects.Particles.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
Focus
Focus
onChange(value)
Focus
Focus

Description:

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

Parameters:

name type description
value number

The value of the property.

Returns:
Description:

This Emitter Op object.

Since: 3.0.0
Focus
Focus
randomRangedValueEmit(particle, key)
Focus
Focus

Description:

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.

Returns:
Description:

The new value of the property.

Type:
  • number
Since: 3.0.0
Focus
Focus
randomStaticValueEmit()
Focus
Focus

Description:

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

Returns:
Description:

The new value of the property.

Type:
  • number
Since: 3.0.0
Focus
Focus
setMethods()
Focus
Focus
Returns:
Description:

This Emitter Op object.

Since: 3.0.0
Focus
Focus
staticValueEmit()
Focus
Focus

Description:

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

Returns:
Description:

The current value of the property.

Type:
  • number
Since: 3.0.0
Focus
Focus
staticValueUpdate()
Focus
Focus

Description:

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

Returns:
Description:

The current value of the property.

Type:
  • number
Since: 3.0.0
Focus
Focus
steppedEmit()
Focus
Focus

Description:

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

Returns:
Description:

The new value of the property.

Type:
  • number
Since: 3.0.0
Focus
Focus
toJSON()
Focus
Focus

Description:

Build a JSON representation of this Particle Emitter property.

Returns:
Description:

A JSON representation of this Particle Emitter property.

Type:
  • object
Since: 3.0.0
Focus
Focus