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.
Type:
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
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
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.

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 boolean <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.

name string <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#name.

on boolean <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#on.

particleBringToTop boolean <optional>

Sets Phaser.GameObjects.Particles.ParticleEmitter#particleBringToTop.

particleClass Phaser.GameObjects.Particles.Particle <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 <optional>

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

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

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

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

Sets Phaser.GameObjects.Particles.ParticleEmitter#alpha.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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#rotate.

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#scaleX.

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

Sets Phaser.GameObjects.Particles.ParticleEmitter#scaleY.

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#tint.

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

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

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

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

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.

reserve number <optional>

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

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.

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
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
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