Phaser API Documentation

  Version: 
Filter
Namespace: Particles
Phaser.Types.GameObjects.Particles

Type Definitions

DeathZoneSource
Focus
Focus
Properties:
Type:
object
Focus
Focus
DeathZoneSourceCallback(x, y)
Focus
Focus

Parameters:

name type description
x number

The x coordinate of the particle to check against this source area.

y number

The y coordinate of the particle to check against this source area.

Type:
function
Returns:
Description:
  • True if the coordinates are within the source area.
Type:
  • boolean
Focus
Focus
EdgeZoneSource
Focus
Focus
Properties:
name type description
getPoints Phaser.Types.GameObjects.Particles.EdgeZoneSourceCallback

A function placing points on the sources edge or edges.

Type:
object
Focus
Focus
EdgeZoneSourceCallback(quantity, [stepRate])
Focus
Focus

Parameters:

name type arguments description
quantity number

The number of particles to place on the source edge. If 0, stepRate should be used instead.

stepRate number <optional>

The distance between each particle. When set, quantity is implied and should be set to 0.

Type:
function
Returns:
Description:
  • The points placed on the source edge.
Focus
Focus
EmitterOpCustomEmitConfig
Focus
Focus
Properties:
name type description
onEmit Phaser.Types.GameObjects.Particles.EmitterOpOnEmitCallback

A callback that is invoked each time the emitter emits a particle.

Type:
object
Focus
Focus
EmitterOpCustomUpdateConfig
Focus
Focus
Properties:
name type arguments description
onEmit Phaser.Types.GameObjects.Particles.EmitterOpOnEmitCallback <optional>

A callback that is invoked each time the emitter emits a particle.

onUpdate Phaser.Types.GameObjects.Particles.EmitterOpOnUpdateCallback

A callback that is invoked each time the emitter updates.

Type:
object
Focus
Focus
EmitterOpEaseConfig
Focus
Focus

Description:

Defines an operation yielding a value incremented continuously across a range.

Properties:
name type arguments Default description
start number

The starting value.

end number

The ending value.

ease string | function <optional> 'Linear'

The ease to find. This can be either a string from the EaseMap, or a custom function.

easeParams Array.<number> <optional>

An optional array of ease parameters to go with the ease.

Type:
object
Focus
Focus
EmitterOpInterpolationConfig
Focus
Focus

Description:

Defines an operation yielding a value incremented continuously across an interpolated data set.

Properties:
name type arguments Default description
values Array.<number>

The array of number values to interpolate through.

interpolation string | function <optional> 'Linear'

The interpolation function to use. Typically one of linear, bezier or catmull or a custom function.

ease string | function <optional> 'Linear'

An optional ease function to use. This can be either a string from the EaseMap, or a custom function.

easeParams Array.<number> <optional>

An optional array of ease parameters to go with the ease.

Type:
object
Focus
Focus
EmitterOpOnEmitCallback(particle, key, value)
Focus
Focus

Description:

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

Parameters:

name type description
particle Phaser.GameObjects.Particles.Particle

The particle.

key string

The name of the property.

value number

The current value of the property.

Type:
function
Returns:
Description:

The new value of the property.

Type:
  • number
Focus
Focus
EmitterOpOnUpdateCallback(particle, key, t, value)
Focus
Focus

Description:

The returned value updates the property for the duration of the particle's life.

Parameters:

name type description
particle Phaser.GameObjects.Particles.Particle

The particle.

key string

The name of the property.

t number

The normalized lifetime of the particle, between 0 (start) and 1 (end).

value number

The current value of the property.

Type:
function
Returns:
Description:

The new value of the property.

Type:
  • number
Focus
Focus
EmitterOpRandomConfig
Focus
Focus

Description:

Defines an operation yielding a random value within a range.

Properties:
name type description
random Array.<number>

The minimum and maximum values, as [min, max].

Type:
object
Focus
Focus
EmitterOpRandomMinMaxConfig
Focus
Focus

Description:

Defines an operation yielding a random value within a range.

Properties:
name type description
min number

The minimum value.

max number

The maximum value.

Type:
object
Focus
Focus
EmitterOpRandomStartEndConfig
Focus
Focus

Description:

Defines an operation yielding a random value within a range.

Properties:
name type description
start number

The starting value.

end number

The ending value.

random boolean

If false, this becomes EmitterOpEaseConfig.

Type:
object
Focus
Focus
EmitterOpSteppedConfig
Focus
Focus

Description:

Defines an operation yielding a value incremented by steps across a range.

Properties:
name type description
start number

The starting value.

end number

The ending value.

steps number

The number of steps between start and end.

Type:
object
Focus
Focus
GravityWellConfig
Focus
Focus
Properties:
name type arguments Default description
x number <optional> 0

The x coordinate of the Gravity Well, in world space.

y number <optional> 0

The y coordinate of the Gravity Well, in world space.

power number <optional> 0

The strength of the gravity force - larger numbers produce a stronger force.

epsilon number <optional> 100

The minimum distance for which the gravity force is calculated.

gravity number <optional> 50

The gravitational force of this Gravity Well.

Type:
object
Focus
Focus
ParticleClassConstructor(emitter)
Focus
Focus

Parameters:

name type description
emitter Phaser.GameObjects.Particles.ParticleEmitter

The Emitter to which this Particle belongs.

Type:
function
Focus
Focus
ParticleDeathCallback(particle)
Focus
Focus

Parameters:

name type description
particle Phaser.GameObjects.Particles.Particle

The particle that died.

Type:
function
Focus
Focus
ParticleEmitterBounds
Focus
Focus
Properties:
name type description
x number

The left edge of the rectangle.

y number

The top edge of the rectangle.

width number

The width of the rectangle.

height number

The height of the rectangle.

Type:
object
Focus
Focus
ParticleEmitterBoundsAlt
Focus
Focus
Properties:
name type description
x number

The left edge of the rectangle.

y number

The top edge of the rectangle.

w number

The width of the rectangle.

h number

The height of the rectangle.

Type:
object
Focus
Focus
ParticleEmitterCallback(particle, emitter)
Focus
Focus

Parameters:

name type description
particle Phaser.GameObjects.Particles.Particle

The particle associated with the call.

emitter Phaser.GameObjects.Particles.ParticleEmitter

This particle emitter associated with the call.

Type:
function
Focus
Focus
ParticleEmitterConfig
Focus
Focus
Properties:
name type arguments description
active boolean <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#active. Setting this to false will stop the emitter from running at all. If you just wish to stop particles from emitting, set emitting property instead.

blendMode string | Phaser.BlendModes <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#blendMode.

callbackScope * <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#deathCallbackScope and Phaser.GameObjects.Particles.ParticleEmitter#emitCallbackScope.

collideBottom boolean <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#collideBottom.

collideLeft boolean <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#collideLeft.

collideRight boolean <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#collideRight.

collideTop boolean <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#collideTop.

deathCallback function <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#deathCallback.

deathCallbackScope * <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#deathCallbackScope.

emitCallback function <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#emitCallback.

emitCallbackScope * <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#emitCallbackScope.

follow Phaser.GameObjects.GameObject <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#follow.

frequency number <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#frequency.

gravityX number <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#gravityX.

gravityY number <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#gravityY.

maxParticles number <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#maxParticles.

maxAliveParticles number <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#maxAliveParticles.

name string <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#name.

emitting boolean <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#emitting.

particleBringToTop boolean <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#particleBringToTop.

particleClass function <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#particleClass.

radial boolean <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#radial.

timeScale number <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#timeScale.

trackVisible boolean <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#trackVisible.

visible boolean <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#visible.

accelerationX Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType | Phaser.Types.GameObjects.Particles.EmitterOpOnUpdateType <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#accelerationX.

accelerationY Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType | Phaser.Types.GameObjects.Particles.EmitterOpOnUpdateType <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#accelerationY.

alpha Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType | Phaser.Types.GameObjects.Particles.EmitterOpOnUpdateType <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#particleAlpha.

angle Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#particleAngle (emit only).

bounce Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType | Phaser.Types.GameObjects.Particles.EmitterOpOnUpdateType <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#bounce.

delay Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#delay (emit only).

hold Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#hold (emit only).

lifespan Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#lifespan (emit only).

maxVelocityX Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType | Phaser.Types.GameObjects.Particles.EmitterOpOnUpdateType <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#maxVelocityX.

maxVelocityY Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType | Phaser.Types.GameObjects.Particles.EmitterOpOnUpdateType <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#maxVelocityY.

moveToX Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType | Phaser.Types.GameObjects.Particles.EmitterOpOnUpdateType <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#moveToX. If set, overrides angle and speed properties.

moveToY Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType | Phaser.Types.GameObjects.Particles.EmitterOpOnUpdateType <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#moveToY. If set, overrides angle and speed properties.

quantity Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#quantity (emit only).

rotate Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType | Phaser.Types.GameObjects.Particles.EmitterOpOnUpdateType <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#particleRotate.

scale Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType | Phaser.Types.GameObjects.Particles.EmitterOpOnUpdateType <optional>

As Phaser.GameObjects.Particles.ParticleEmitter#setScale.

scaleX Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType | Phaser.Types.GameObjects.Particles.EmitterOpOnUpdateType <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#particleScaleX.

scaleY Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType | Phaser.Types.GameObjects.Particles.EmitterOpOnUpdateType <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#particleScaleY.

speed Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType <optional>

As Phaser.GameObjects.Particles.ParticleEmitter#setSpeed (emit only).

speedX Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#speedX (emit only).

speedY Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#speedY (emit only).

tint Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType | Phaser.Types.GameObjects.Particles.EmitterOpOnUpdateType <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#particleTint.

color Array.<number> <optional>

An array of color values that the Particles interpolate through during theif life. If set, overrides any tint property.

colorEase string <optional>

The string-based name of the Easing function to use if you have enabled Particle color interpolation via the color property, otherwise has no effect.

x Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#particleX.

y Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#particleY.

emitZone Phaser.Types.GameObjects.Particles.ParticleEmitterEdgeZoneConfig | Phaser.Types.GameObjects.Particles.ParticleEmitterRandomZoneConfig <optional>

As Phaser.GameObjects.Particles.ParticleEmitter#setEmitZone.

deathZone Phaser.Types.GameObjects.Particles.ParticleEmitterDeathZoneConfig <optional>

As Phaser.GameObjects.Particles.ParticleEmitter#setDeathZone.

bounds Phaser.Types.GameObjects.Particles.ParticleEmitterBounds | Phaser.Types.GameObjects.Particles.ParticleEmitterBoundsAlt <optional>

As Phaser.GameObjects.Particles.ParticleEmitter#setBounds.

followOffset object <optional>

Assigns to Phaser.GameObjects.Particles.ParticleEmitter#followOffset.

followOffset.x number <optional>

x coordinate of the offset.

followOffset.y number <optional>

y coordinate of the offset.

frame number | Array.<number> | string | Array.<string> | Phaser.Textures.Frame | Array.<Phaser.Textures.Frame> | Phaser.Types.GameObjects.Particles.ParticleEmitterFrameConfig <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#frames.

texture string | Phaser.Textures.Frame <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#texture. Overrides any texture already set on the Emitter.

reserve number <optional>

Creates specified number of inactive particles and adds them to this emitter's pool. Phaser.GameObjects.Particles.ParticleEmitter#reserve

advance number <optional>

If you wish to 'fast forward' the emitter in time, set this value to a number representing the amount of ms the emitter should advance.

duration number <optional>

Limit the emitter to emit particles for a maximum of duration ms. Default to zero, meaning 'forever'.

stopAfter number <optional>

Limit the emitter to emit this exact number of particles and then stop. Default to zero, meaning no limit.

sortCallback Phaser.Types.GameObjects.Particles.ParticleSortCallback <optional>

A custom callback that sorts particles prior to rendering. Sets Phaser.GameObjects.Particles.ParticleEmitter#sortCallback.

sortOrderAsc boolean <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#sortOrderAsc.

sortProperty string <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#sortProperty.

tintFill boolean <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#tintFill.

Type:
object
Focus
Focus
ParticleEmitterCreatorConfig
Focus
Focus
Properties:
name type arguments description
key string <optional>

The key of the Texture this Emitter will use to render particles, as stored in the Texture Manager.

config Phaser.Types.GameObjects.Particles.ParticleEmitterConfig <optional>

The Particle Emitter configuration object.

Type:
object
Focus
Focus
ParticleEmitterDeathZoneConfig
Focus
Focus
Properties:
name type arguments Default description
source Phaser.Types.GameObjects.Particles.DeathZoneSource

A shape representing the zone. See Phaser.GameObjects.Particles.Zones.DeathZone#source.

type string <optional> 'onEnter'

'onEnter' or 'onLeave'.

Type:
object
Focus
Focus
ParticleEmitterEdgeZoneConfig
Focus
Focus
Properties:
name type arguments Default description
source Phaser.Types.GameObjects.Particles.EdgeZoneSource

A shape representing the zone. See Phaser.GameObjects.Particles.Zones.EdgeZone#source.

type string

'edge'.

quantity number

The number of particles to place on the source edge. Set to 0 to use stepRate instead.

stepRate number <optional>

The distance between each particle. When set, quantity is implied and should be set to 0.

yoyo boolean <optional> false

Whether particles are placed from start to end and then end to start.

seamless boolean <optional> true

Whether one endpoint will be removed if it's identical to the other.

total number <optional> 1

The total number of particles this zone will emit before passing over to the next emission zone in the Emitter.

Type:
object
Focus
Focus
ParticleEmitterFrameConfig
Focus
Focus
Properties:
name type arguments description
frames number | Array.<number> | string | Array.<string> | Phaser.Textures.Frame | Array.<Phaser.Textures.Frame> <optional>

One or more texture frames.

cycle boolean <optional>

Whether texture frames will be assigned consecutively (true) or at random (false).

quantity number <optional>

The number of consecutive particles receiving each texture frame, when cycle is true.

Type:
object
Focus
Focus
ParticleEmitterOps
Focus
Focus
Properties:
name type description
accelerationX Phaser.GameObjects.Particles.EmitterOp

The accelerationX EmitterOp instance. This is an onEmit and onUpdate operator.

accelerationY Phaser.GameObjects.Particles.EmitterOp

The accelerationY EmitterOp instance. This is an onEmit and onUpdate operator.

alpha Phaser.GameObjects.Particles.EmitterOp

The alpha EmitterOp instance. This is an onEmit and onUpdate operator.

angle Phaser.GameObjects.Particles.EmitterOp

The angle EmitterOp instance. This is an onEmit operator only.

bounce Phaser.GameObjects.Particles.EmitterOp

The bounce EmitterOp instance. This is an onEmit and onUpdate operator.

color Phaser.GameObjects.Particles.EmitterColorOp

The color EmitterColorOp instance. This is an onEmit and onUpdate operator.

delay Phaser.GameObjects.Particles.EmitterOp

The delay EmitterOp instance. This is an onEmit operator only.

hold Phaser.GameObjects.Particles.EmitterOp

The hold EmitterOp instance. This is an onEmit operator only.

lifespan Phaser.GameObjects.Particles.EmitterOp

The lifespan EmitterOp instance. This is an onEmit operator only.

maxVelocityX Phaser.GameObjects.Particles.EmitterOp

The maxVelocityX EmitterOp instance. This is an onEmit and onUpdate operator.

maxVelocityY Phaser.GameObjects.Particles.EmitterOp

The maxVelocityY EmitterOp instance. This is an onEmit and onUpdate operator.

moveToX Phaser.GameObjects.Particles.EmitterOp

The moveToX EmitterOp instance. This is an onEmit and onUpdate operator.

moveToY Phaser.GameObjects.Particles.EmitterOp

The moveToY EmitterOp instance. This is an onEmit and onUpdate operator.

quantity Phaser.GameObjects.Particles.EmitterOp

The quantity EmitterOp instance. This is an onEmit operator only.

rotate Phaser.GameObjects.Particles.EmitterOp

The rotate EmitterOp instance. This is an onEmit and onUpdate operator.

scaleX Phaser.GameObjects.Particles.EmitterOp

The scaleX EmitterOp instance. This is an onEmit and onUpdate operator.

scaleY Phaser.GameObjects.Particles.EmitterOp

The scaleY EmitterOp instance. This is an onEmit and onUpdate operator.

speedX Phaser.GameObjects.Particles.EmitterOp

The speedX EmitterOp instance. This is an onEmit operator only.

speedY Phaser.GameObjects.Particles.EmitterOp

The speedY EmitterOp instance. This is an onEmit operator only.

tint Phaser.GameObjects.Particles.EmitterOp

The tint EmitterOp instance. This is an onEmit and onUpdate operator.

x Phaser.GameObjects.Particles.EmitterOp

The x EmitterOp instance. This is an onEmit and onUpdate operator.

y Phaser.GameObjects.Particles.EmitterOp

The y EmitterOp instance. This is an onEmit and onUpdate operator.

Type:
object
Focus
Focus
ParticleEmitterRandomZoneConfig
Focus
Focus
Properties:
name type arguments description
source Phaser.Types.GameObjects.Particles.RandomZoneSource

A shape representing the zone. See Phaser.GameObjects.Particles.Zones.RandomZone#source.

type string <optional>

'random'.

Type:
object
Focus
Focus
ParticleSortCallback(a, b)
Focus
Focus

Parameters:

name type description
a Phaser.GameObjects.Particles.Particle

The first Particle being compared.

b Phaser.GameObjects.Particles.Particle

The second Particle being compared.

Type:
function
Focus
Focus
RandomZoneSource
Focus
Focus
Properties:
name type description
getRandomPoint Phaser.Types.GameObjects.Particles.RandomZoneSourceCallback

A function modifying its point argument.

Type:
object
Focus
Focus
RandomZoneSourceCallback(point)
Focus
Focus

Parameters:

name type description
point Phaser.Types.Math.Vector2Like

A point to modify.

Type:
function
Focus
Focus