Phaser API Documentation

  Version: 
Filter
This is a beta release of our new docs system. Found an issue?
Please tell us about it in the #📖-newdocs-feedback channel on the Phaser Discord

Phaser . GameObjects . Particles . ParticleEmitter

This is a beta release of our new docs system. Found an issue?
Please tell us about it in the #📖-newdocs-feedback channel on the Phaser Discord

Phaser . GameObjects . Particles . ParticleEmitter

A particle emitter represents a single particle stream. It controls a pool of Particles and is controlled by a Particle.

Constructor:

new ParticleEmitter(manager, config)

Parameters:

name type description
manager Phaser.GameObjects.Particles.ParticleEmitterManager

The Emitter Manager this Emitter belongs to.

config Phaser.Types.GameObjects.Particles.ParticleEmitterConfig

Settings for this emitter.

Since: 3.0.0

Extends


Members

<private> _blendMode: number
Focus
Focus

Description:

Private internal value. Holds the current blend mode.

Type:
number
Default: 0
Inherited from: Phaser.GameObjects.Components.BlendMode#_blendMode
Since: 3.0.0
Focus
Focus
<private> _counter: number
Focus
Focus

Description:

The time until the next flow cycle.

Type:
number
Default: 0
Focus
Focus
<private> _frameCounter: number
Focus
Focus
Type:
number
Default: 0
Focus
Focus
<private> _visible: boolean
Focus
Focus

Description:

Private internal value. Holds the visible value.

Type:
boolean
Default: true
Inherited from: Phaser.GameObjects.Components.Visible#_visible
Since: 3.0.0
Focus
Focus
acceleration: boolean
Focus
Focus

Description:

Whether accelerationX and accelerationY are non-zero. Set automatically during configuration.

Type:
boolean
Default: false
Focus
Focus

Description:

Horizontal acceleration applied to emitted particles, in pixels per second squared.

Type:
Default: 0
Focus
Focus

Description:

Vertical acceleration applied to emitted particles, in pixels per second squared.

Type:
Default: 0
Focus
Focus
active: boolean
Focus
Focus

Description:

Whether this emitter updates itself and its particles.

Controlled by Phaser.GameObjects.Particles.ParticleEmitter#pause and Phaser.GameObjects.Particles.ParticleEmitter#resume.

Type:
boolean
Default: true
Focus
Focus
<private> alive: Array.<Phaser.GameObjects.Particles.Particle>
Focus
Focus

Description:

Active particles

Type:
Focus
Focus

Description:

The alpha (transparency) of emitted particles.

Type:
Default: 1
Focus
Focus

Description:

The angle of the initial velocity of emitted particles, in degrees.

Type:
Default: { min: 0, max: 360 }
Focus
Focus
blendMode: number
Focus
Focus

Description:

The blend mode of this emitter's particles.

Type:
number
Overrides: Phaser.GameObjects.Components.BlendMode#blendMode
Focus
Focus

Description:

Whether particles will rebound when they meet the emitter bounds.

Type:
Default: 0
Focus
Focus
<nullable> bounds: Phaser.Geom.Rectangle
Focus
Focus

Description:

A rectangular boundary constraining particle movement.

Type:
Default: null
Focus
Focus
collideBottom: boolean
Focus
Focus

Description:

Whether particles interact with the bottom edge of the emitter Phaser.GameObjects.Particles.ParticleEmitter#bounds.

Type:
boolean
Default: true
Focus
Focus
collideLeft: boolean
Focus
Focus

Description:

Whether particles interact with the left edge of the emitter Phaser.GameObjects.Particles.ParticleEmitter#bounds.

Type:
boolean
Default: true
Focus
Focus
collideRight: boolean
Focus
Focus

Description:

Whether particles interact with the right edge of the emitter Phaser.GameObjects.Particles.ParticleEmitter#bounds.

Type:
boolean
Default: true
Focus
Focus
collideTop: boolean
Focus
Focus

Description:

Whether particles interact with the top edge of the emitter Phaser.GameObjects.Particles.ParticleEmitter#bounds.

Type:
boolean
Default: true
Focus
Focus
configFastMap: object
Focus
Focus

Description:

Names of simple configuration properties.

Type:
object
Since: 3.0.0
Focus
Focus
configOpMap: object
Focus
Focus

Description:

Names of complex configuration properties.

Type:
object
Focus
Focus
currentFrame: number
Focus
Focus

Description:

The current texture frame, as an index of Phaser.GameObjects.Particles.ParticleEmitter#frames.

Type:
number
Default: 0
Focus
Focus
<private> dead: Array.<Phaser.GameObjects.Particles.Particle>
Focus
Focus

Description:

Inactive particles.

Type:
Focus
Focus

Description:

A function to call when a particle dies.

Type:
Default: null
Focus
Focus
<nullable> deathCallbackScope: *
Focus
Focus

Description:

The calling context for Phaser.GameObjects.Particles.ParticleEmitter#deathCallback.

Type:
*
Default: null
Focus
Focus

Description:

An object describing a shape that deactivates particles when they interact with it.

Type:
Default: null
Focus
Focus
defaultFrame: Phaser.Textures.Frame
Focus
Focus

Description:

The default texture frame assigned to particles.

Type:
Since: 3.0.0
Focus
Focus

Description:

How many ms to wait after emission before the particles start updating.

Type:
Default: 0
Focus
Focus

Description:

A function to call when a particle is emitted.

Type:
Default: null
Focus
Focus
<nullable> emitCallbackScope: *
Focus
Focus

Description:

The calling context for Phaser.GameObjects.Particles.ParticleEmitter#emitCallback.

Type:
*
Default: null
Focus
Focus
<nullable> follow: Phaser.GameObjects.GameObject
Focus
Focus

Description:

A Game Object whose position is used as the particle origin.

Type:
Default: null
Focus
Focus
followOffset: Phaser.Math.Vector2
Focus
Focus

Description:

The offset of the particle origin from the Phaser.GameObjects.Particles.ParticleEmitter#follow target.

Type:
Focus
Focus
frameQuantity: number
Focus
Focus

Description:

The number of consecutive particles that receive a single texture frame (per frame cycle).

Type:
number
Default: 1
Focus
Focus
frames: Array.<Phaser.Textures.Frame>
Focus
Focus

Description:

The texture frames assigned to particles.

Type:
Since: 3.0.0
Focus
Focus
frequency: number
Focus
Focus

Description:

For a flow emitter, the time interval (>= 0) between particle flow cycles in ms. A value of 0 means there is one particle flow cycle for each logic update (the maximum flow frequency). This is the default setting. For an exploding emitter, this value will be -1. Calling Phaser.GameObjects.Particles.ParticleEmitter#flow also puts the emitter in flow mode (frequency >= 0). Calling Phaser.GameObjects.Particles.ParticleEmitter#explode also puts the emitter in explode mode (frequency = -1).

Type:
number
Default: 0
Focus
Focus
gravityX: number
Focus
Focus

Description:

Horizontal acceleration applied to emitted particles, in pixels per second squared.

Type:
number
Default: 0
Focus
Focus
gravityY: number
Focus
Focus

Description:

Vertical acceleration applied to emitted particles, in pixels per second squared.

Type:
number
Default: 0
Focus
Focus

Description:

The lifespan of emitted particles, in ms.

Type:
Default: 1000
Focus
Focus

Description:

The Emitter Manager this Emitter belongs to.

Type:
Since: 3.0.0
Focus
Focus
maxParticles: number
Focus
Focus

Description:

Set to hard limit the amount of particle objects this emitter is allowed to create. 0 means unlimited.

Type:
number
Default: 0
Focus
Focus

Description:

The maximum horizontal velocity of emitted particles, in pixels per second squared.

Type:
Default: 10000
Focus
Focus

Description:

The maximum vertical velocity of emitted particles, in pixels per second squared.

Type:
Default: 10000
Focus
Focus
moveTo: boolean
Focus
Focus

Description:

Whether moveToX and moveToY are nonzero. Set automatically during configuration.

Type:
boolean
Default: false
Focus
Focus

Description:

The x-coordinate emitted particles move toward, when Phaser.GameObjects.Particles.ParticleEmitter#moveTo is true.

Type:
Default: 0
Focus
Focus

Description:

The y-coordinate emitted particles move toward, when Phaser.GameObjects.Particles.ParticleEmitter#moveTo is true.

Type:
Default: 0
Focus
Focus
name: string
Focus
Focus

Description:

The name of this Particle Emitter.

Empty by default and never populated by Phaser, this is left for developers to use.

Type:
string
Default: ''
Focus
Focus
on: boolean
Focus
Focus

Description:

Controls if the emitter is currently emitting a particle flow (when frequency >= 0). Already alive particles will continue to update until they expire. Controlled by Phaser.GameObjects.Particles.ParticleEmitter#start and Phaser.GameObjects.Particles.ParticleEmitter#stop.

Type:
boolean
Default: true
Focus
Focus
particleBringToTop: boolean
Focus
Focus

Description:

Newly emitted particles are added to the top of the particle list, i.e. rendered above those already alive. Set to false to send them to the back.

Type:
boolean
Default: true
Focus
Focus

Description:

The Particle Class which will be emitted by this Emitter.

Type:
Default: Phaser.GameObjects.Particles.Particle
Focus
Focus

Description:

How many particles are emitted each time particles are emitted (one explosion or one flow cycle).

Type:
Default: 1
Focus
Focus
radial: boolean
Focus
Focus

Description:

A radial emitter will emit particles in all directions between angle min and max, using Phaser.GameObjects.Particles.ParticleEmitter#speed as the value. If set to false then this acts as a point Emitter. A point emitter will emit particles only in the direction derived from the speedX and speedY values.

Type:
boolean
Default: true
Focus
Focus
randomFrame: boolean
Focus
Focus

Description:

Whether texture Phaser.GameObjects.Particles.ParticleEmitter#frames are selected at random.

Type:
boolean
Default: true
Focus
Focus

Description:

The rotation of emitted particles, in degrees.

Type:
Default: 0
Focus
Focus

Description:

The horizontal scale of emitted particles.

Type:
Default: 1
Focus
Focus

Description:

The vertical scale of emitted particles.

Type:
Default: 1
Focus
Focus
scrollFactorX: number
Focus
Focus

Description:

The horizontal scroll factor of this Game Object.

The scroll factor controls the influence of the movement of a Camera upon this Game Object.

When a camera scrolls it will change the location at which this Game Object is rendered on-screen. It does not change the Game Objects actual position values.

A value of 1 means it will move exactly in sync with a camera. A value of 0 means it will not move at all, even if the camera moves. Other values control the degree to which the camera movement is mapped to this Game Object.

Please be aware that scroll factor values other than 1 are not taken in to consideration when calculating physics collisions. Bodies always collide based on their world position, but changing the scroll factor is a visual adjustment to where the textures are rendered, which can offset them from physics bodies if not accounted for in your code.

Type:
number
Default: 1
Inherited from: Phaser.GameObjects.Components.ScrollFactor#scrollFactorX
Since: 3.0.0
Focus
Focus
scrollFactorY: number
Focus
Focus

Description:

The vertical scroll factor of this Game Object.

The scroll factor controls the influence of the movement of a Camera upon this Game Object.

When a camera scrolls it will change the location at which this Game Object is rendered on-screen. It does not change the Game Objects actual position values.

A value of 1 means it will move exactly in sync with a camera. A value of 0 means it will not move at all, even if the camera moves. Other values control the degree to which the camera movement is mapped to this Game Object.

Please be aware that scroll factor values other than 1 are not taken in to consideration when calculating physics collisions. Bodies always collide based on their world position, but changing the scroll factor is a visual adjustment to where the textures are rendered, which can offset them from physics bodies if not accounted for in your code.

Type:
number
Default: 1
Inherited from: Phaser.GameObjects.Components.ScrollFactor#scrollFactorY
Since: 3.0.0
Focus
Focus

Description:

The initial horizontal speed of emitted particles, in pixels per second.

Type:
Default: 0
Focus
Focus

Description:

The initial vertical speed of emitted particles, in pixels per second.

Type:
Default: 0
Focus
Focus

Description:

The texture assigned to particles.

Type:
Since: 3.0.0
Focus
Focus
timeScale: number
Focus
Focus

Description:

The time rate applied to active particles, affecting lifespan, movement, and tweens. Values larger than 1 are faster than normal.

Type:
number
Default: 1
Focus
Focus

Description:

Color tint applied to emitted particles. Value must not include the alpha channel.

Type:
Default: 0xffffff
Focus
Focus
trackVisible: boolean
Focus
Focus

Description:

Whether the emitter's Phaser.GameObjects.Particles.ParticleEmitter#visible state will track the Phaser.GameObjects.Particles.ParticleEmitter#follow target's visibility state.

Type:
boolean
Default: false
Focus
Focus
visible: boolean
Focus
Focus

Description:

Set this to false to hide any active particles.

Type:
boolean
Default: true
Overrides: Phaser.GameObjects.Components.Visible#visible
Focus
Focus

Description:

The x-coordinate of the particle origin (where particles will be emitted).

Type:
Default: 0
Focus
Focus

Description:

The y-coordinate of the particle origin (where particles will be emitted).

Type:
Default: 0
Focus
Focus

Methods

atLimit()
Focus
Focus

Description:

Whether this emitter is at its limit (if set).

Returns:
Description:

Returns true if this Emitter is at its limit, or false if no limit, or below the maxParticles level.

Type:
  • boolean
Examples:
Focus
Focus
clearMask([destroyMask])
Focus
Focus

Description:

Clears the mask that this Game Object was using.

Parameters:

name type arguments Default description
destroyMask boolean <optional> false

Destroy the mask before clearing it?

Returns:
Description:

This Game Object instance.

Inherited from: Phaser.GameObjects.Components.Mask#clearMask
Examples:
Since: 3.6.2
Focus
Focus
createBitmapMask([renderable])
Focus
Focus

Description:

Creates and returns a Bitmap Mask. This mask can be used by any Game Object, including this one.

Note: Bitmap Masks only work on WebGL. Geometry Masks work on both WebGL and Canvas.

To create the mask you need to pass in a reference to a renderable Game Object. A renderable Game Object is one that uses a texture to render with, such as an Image, Sprite, Render Texture or BitmapText.

If you do not provide a renderable object, and this Game Object has a texture, it will use itself as the object. This means you can call this method to create a Bitmap Mask from any renderable Game Object.

Parameters:

name type arguments description
renderable Phaser.GameObjects.GameObject <optional>

A renderable Game Object that uses a texture, such as a Sprite.

Returns:
Description:

This Bitmap Mask that was created.

Inherited from: Phaser.GameObjects.Components.Mask#createBitmapMask
Examples:
Since: 3.6.2
Focus
Focus
createGeometryMask([graphics])
Focus
Focus

Description:

Creates and returns a Geometry Mask. This mask can be used by any Game Object, including this one.

To create the mask you need to pass in a reference to a Graphics Game Object.

If you do not provide a graphics object, and this Game Object is an instance of a Graphics object, then it will use itself to create the mask.

This means you can call this method to create a Geometry Mask from any Graphics Game Object.

Parameters:

name type arguments description
graphics Phaser.GameObjects.Graphics <optional>

A Graphics Game Object. The geometry within it will be used as the mask.

Returns:
Description:

This Geometry Mask that was created.

Inherited from: Phaser.GameObjects.Components.Mask#createGeometryMask
Examples:
Since: 3.6.2
Focus
Focus
depthSort()
Focus
Focus

Description:

Sorts active particles with Phaser.GameObjects.Particles.ParticleEmitter#depthSortCallback.

Returns:
Description:

This Particle Emitter.

Examples:
Focus
Focus
depthSortCallback(a, b)
Focus
Focus

Description:

Calculates the difference of two particles, for sorting them by depth.

Parameters:

name type description
a object

The first particle.

b object

The second particle.

Returns:
Description:

The difference of a and b's y coordinates.

Type:
  • number
Examples:
Focus
Focus
emitParticle([count], [x], [y])
Focus
Focus

Description:

Emits particles at a given position (or the emitter's current position).

Parameters:

name type arguments Default description
count number <optional> this.quantity

The number of Particles to emit.

x number <optional> this.x

The x coordinate to emit the Particles from.

y number <optional> this.x

The y coordinate to emit the Particles from.

Returns:
Description:

The most recently emitted Particle.

Examples:
Focus
Focus
emitParticleAt([x], [y], [count])
Focus
Focus

Description:

Emits particles at a given position (or the emitter's current position).

Parameters:

name type arguments Default description
x number <optional> this.x

The x coordinate to emit the Particles from.

y number <optional> this.x

The y coordinate to emit the Particles from.

count number <optional> this.quantity

The number of Particles to emit.

Returns:
Description:

The most recently emitted Particle.

Examples:
Focus
Focus
explode(count, x, y)
Focus
Focus

Description:

Puts the emitter in explode mode (frequency = -1), stopping any current particle flow, and emits several particles all at once.

Parameters:

name type description
count number

The amount of Particles to emit.

x number

The x coordinate to emit the Particles from.

y number

The y coordinate to emit the Particles from.

Returns:
Description:

The most recently emitted Particle.

Examples:
Focus
Focus
flow(frequency, [count])
Focus
Focus

Description:

Puts the emitter in flow mode (frequency >= 0) and starts (or restarts) a particle flow.

To resume a flow at the current frequency and quantity, use Phaser.GameObjects.Particles.ParticleEmitter#start instead.

Parameters:

name type arguments Default description
frequency number

The time interval (>= 0) of each flow cycle, in ms.

count Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType <optional> 1

The number of particles to emit at each flow cycle.

Returns:
Description:

This Particle Emitter.

Examples:
Focus
Focus
forEachAlive(callback, context)
Focus
Focus

Description:

Calls a function for each active particle in this emitter.

Parameters:

name type description
callback Phaser.Types.GameObjects.Particles.ParticleEmitterCallback

The function.

context *

The function's calling context.

Returns:
Description:

This Particle Emitter.

Examples:
Focus
Focus
forEachDead(callback, context)
Focus
Focus

Description:

Calls a function for each inactive particle in this emitter.

Parameters:

name type description
callback Phaser.Types.GameObjects.Particles.ParticleEmitterCallback

The function.

context *

The function's calling context.

Returns:
Description:

This Particle Emitter.

Examples:
Focus
Focus
fromJSON(config)
Focus
Focus

Description:

Merges configuration settings into the emitter's current settings.

Parameters:

name type description
config Phaser.Types.GameObjects.Particles.ParticleEmitterConfig

Settings for this emitter.

Returns:
Description:

This Particle Emitter.

Examples:
Focus
Focus
getAliveParticleCount()
Focus
Focus

Description:

Gets the number of active (in-use) particles in this emitter.

Returns:
Description:

The number of particles with active=true.

Type:
  • number
Examples:
Focus
Focus
getDeadParticleCount()
Focus
Focus

Description:

Gets the number of inactive (available) particles in this emitter.

Returns:
Description:

The number of particles with active=false.

Type:
  • number
Examples:
Focus
Focus
getFrame()
Focus
Focus

Description:

Chooses a texture frame from Phaser.GameObjects.Particles.ParticleEmitter#frames.

Returns:
Description:

The texture frame.

Examples:
Focus
Focus
getParticleCount()
Focus
Focus

Description:

Gets the total number of particles in this emitter.

Returns:
Description:

The number of particles, including both alive and dead.

Type:
  • number
Examples:
Focus
Focus
killAll()
Focus
Focus

Description:

Deactivates every particle in this emitter.

Returns:
Description:

This Particle Emitter.

Examples:
Focus
Focus
onParticleDeath(callback, [context])
Focus
Focus

Description:

Sets a function to call for each particle death.

Parameters:

name type arguments description
callback Phaser.Types.GameObjects.Particles.ParticleDeathCallback

The function.

context * <optional>

The function's calling context.

Returns:
Description:

This Particle Emitter.

Examples:
Focus
Focus
onParticleEmit(callback, [context])
Focus
Focus

Description:

Sets a function to call for each newly emitted particle.

Parameters:

name type arguments description
callback Phaser.Types.GameObjects.Particles.ParticleEmitterCallback

The function.

context * <optional>

The calling context.

Returns:
Description:

This Particle Emitter.

Examples:
Focus
Focus
pause()
Focus
Focus

Description:

Deactivates the emitter.

Returns:
Description:

This Particle Emitter.

Examples:
Focus
Focus
preUpdate(time, delta)
Focus
Focus

Description:

Updates this emitter and its particles.

Parameters:

name type description
time number

The current timestamp as generated by the Request Animation Frame or SetTimeout.

delta number

The delta time, in ms, elapsed since the last frame.

Examples:
Focus
Focus
remove()
Focus
Focus

Description:

Removes the emitter from its manager and the scene.

Returns:
Description:

This Particle Emitter.

Examples:
Since: 3.22.0
Focus
Focus
reserve(particleCount)
Focus
Focus

Description:

Creates inactive particles and adds them to this emitter's pool.

Parameters:

name type description
particleCount number

The number of particles to create.

Returns:
Description:

This Particle Emitter.

Examples:
Focus
Focus
resume()
Focus
Focus

Description:

Activates the emitter.

Returns:
Description:

This Particle Emitter.

Examples:
Focus
Focus
setAlpha(value)
Focus
Focus

Description:

Sets the opacity of emitted particles.

Parameters:

name type description
value Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType | Phaser.Types.GameObjects.Particles.EmitterOpOnUpdateType

A value between 0 (transparent) and 1 (opaque).

Returns:
Description:

This Particle Emitter.

Examples:
Focus
Focus
setAngle(value)
Focus
Focus

Description:

Sets the angle of a Phaser.GameObjects.Particles.ParticleEmitter#radial particle stream.

Parameters:

name type description
value Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType

The angle of the initial velocity of emitted particles.

Returns:
Description:

This Particle Emitter.

Examples:
Focus
Focus
setBlendMode(value)
Focus
Focus

Description:

Sets the Blend Mode being used by this Game Object.

This can be a const, such as Phaser.BlendModes.SCREEN, or an integer, such as 4 (for Overlay)

Under WebGL only the following Blend Modes are available:

  • ADD
  • MULTIPLY
  • SCREEN
  • ERASE (only works when rendering to a framebuffer, like a Render Texture)

Canvas has more available depending on browser support.

You can also create your own custom Blend Modes in WebGL.

Blend modes have different effects under Canvas and WebGL, and from browser to browser, depending on support. Blend Modes also cause a WebGL batch flush should it encounter a new blend mode. For these reasons try to be careful about the construction of your Scene and the frequency in which blend modes are used.

Parameters:

name type description
value string | Phaser.BlendModes

The BlendMode value. Either a string or a CONST.

Returns:
Description:

This Game Object instance.

Inherited from: Phaser.GameObjects.Components.BlendMode#setBlendMode
Examples:
Since: 3.0.0
Focus
Focus
setBounds(x, y, width, height)
Focus
Focus

Description:

Sets or modifies a rectangular boundary constraining the particles.

To remove the boundary, set Phaser.GameObjects.Particles.ParticleEmitter#bounds to null.

Parameters:

name type description
x number | Phaser.Types.GameObjects.Particles.ParticleEmitterBounds | Phaser.Types.GameObjects.Particles.ParticleEmitterBoundsAlt

The x-coordinate of the left edge of the boundary, or an object representing a rectangle.

y number

The y-coordinate of the top edge of the boundary.

width number

The width of the boundary.

height number

The height of the boundary.

Returns:
Description:

This Particle Emitter.

Examples:
Focus
Focus
setDeathZone([zoneConfig])
Focus
Focus

Description:

Sets or removes the Phaser.GameObjects.Particles.ParticleEmitter#deathZone.

Parameters:

name type arguments description
zoneConfig Phaser.Types.GameObjects.Particles.ParticleEmitterDeathZoneConfig <optional>

An object describing the zone, or undefined to remove any current death zone.

Returns:
Description:

This Particle Emitter.

Examples:
Focus
Focus
setEmitZone([zoneConfig])
Focus
Focus

Description:

Sets or removes the Phaser.GameObjects.Particles.ParticleEmitter#emitZone.

An EdgeZone places particles on its edges. Its source can be a Curve, Path, Circle, Ellipse, Line, Polygon, Rectangle, or Triangle; or any object with a suitable getPoints method.

A RandomZone places randomly within its interior. Its source can be a Circle, Ellipse, Line, Polygon, Rectangle, or Triangle; or any object with a suitable getRandomPoint method.

Parameters:

name type arguments description
zoneConfig Phaser.Types.GameObjects.Particles.ParticleEmitterEdgeZoneConfig | Phaser.Types.GameObjects.Particles.ParticleEmitterRandomZoneConfig <optional>

An object describing the zone, or undefined to remove any current emit zone.

Returns:
Description:

This Particle Emitter.

Examples:
Focus
Focus
setEmitterAngle(value)
Focus
Focus

Description:

Sets the angle of a Phaser.GameObjects.Particles.ParticleEmitter#radial particle stream.

Parameters:

name type description
value Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType

The angle of the initial velocity of emitted particles.

Returns:
Description:

This Particle Emitter.

Examples:
Focus
Focus
setFrame(frames, [pickRandom], [quantity])
Focus
Focus

Description:

Sets a pattern for assigning texture frames to emitted particles.

Parameters:

name type arguments Default description
frames array | string | number | Phaser.Types.GameObjects.Particles.ParticleEmitterFrameConfig

One or more texture frames, or a configuration object.

pickRandom boolean <optional> true

Whether frames should be assigned at random from frames.

quantity number <optional> 1

The number of consecutive particles that will receive each frame.

Returns:
Description:

This Particle Emitter.

Examples:
Focus
Focus
setFrequency(frequency, [quantity])
Focus
Focus

Parameters:

name type arguments description
frequency number

The time interval (>= 0) of each flow cycle, in ms; or -1 to put the emitter in explosion mode.

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

The number of particles to release at each flow cycle or explosion.

Returns:
Description:

This Particle Emitter.

Examples:
Focus
Focus
setGravity(x, y)
Focus
Focus

Description:

Sets the gravity applied to emitted particles.

Parameters:

name type description
x number

Horizontal acceleration due to gravity, in pixels per second squared.

y number

Vertical acceleration due to gravity, in pixels per second squared.

Returns:
Description:

This Particle Emitter.

Examples:
Focus
Focus
setGravityX(value)
Focus
Focus

Description:

Sets the horizontal gravity applied to emitted particles.

Parameters:

name type description
value number

Acceleration due to gravity, in pixels per second squared.

Returns:
Description:

This Particle Emitter.

Examples:
Focus
Focus
setGravityY(value)
Focus
Focus

Description:

Sets the vertical gravity applied to emitted particles.

Parameters:

name type description
value number

Acceleration due to gravity, in pixels per second squared.

Returns:
Description:

This Particle Emitter.

Examples:
Focus
Focus
setLifespan(value)
Focus
Focus

Description:

Sets the lifespan of newly emitted particles.

Parameters:

name type description
value Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType

The particle lifespan, in ms.

Returns:
Description:

This Particle Emitter.

Examples:
Focus
Focus
setMask(mask)
Focus
Focus

Description:

Sets the mask that this Game Object will use to render with.

The mask must have been previously created and can be either a GeometryMask or a BitmapMask. Note: Bitmap Masks only work on WebGL. Geometry Masks work on both WebGL and Canvas.

If a mask is already set on this Game Object it will be immediately replaced.

Masks are positioned in global space and are not relative to the Game Object to which they are applied. The reason for this is that multiple Game Objects can all share the same mask.

Masks have no impact on physics or input detection. They are purely a rendering component that allows you to limit what is visible during the render pass.

Parameters:

name type description
mask Phaser.Display.Masks.BitmapMask | Phaser.Display.Masks.GeometryMask

The mask this Game Object will use when rendering.

Returns:
Description:

This Game Object instance.

Inherited from: Phaser.GameObjects.Components.Mask#setMask
Examples:
Since: 3.6.2
Focus
Focus
setPosition(x, y)
Focus
Focus

Description:

Sets the position of the emitter's particle origin. New particles will be emitted here.

Parameters:

name type description
x Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType

The x-coordinate of the particle origin.

y Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType

The y-coordinate of the particle origin.

Returns:
Description:

This Particle Emitter.

Examples:
Focus
Focus
setQuantity(quantity)
Focus
Focus

Description:

Sets the number of particles released at each flow cycle or explosion.

Parameters:

name type description
quantity Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType

The number of particles to release at each flow cycle or explosion.

Returns:
Description:

This Particle Emitter.

Examples:
Focus
Focus
setRadial([value])
Focus
Focus

Description:

Turns Phaser.GameObjects.Particles.ParticleEmitter#radial particle movement on or off.

Parameters:

name type arguments Default description
value boolean <optional> true

Radial mode (true) or point mode (true).

Returns:
Description:

This Particle Emitter.

Examples:
Focus
Focus
setScale(value)
Focus
Focus

Description:

Sets the scale of emitted particles.

Parameters:

Returns:
Description:

This Particle Emitter.

Examples:
Focus
Focus
setScaleX(value)
Focus
Focus

Description:

Sets the horizontal scale of emitted particles.

Parameters:

Returns:
Description:

This Particle Emitter.

Examples:
Focus
Focus
setScaleY(value)
Focus
Focus

Description:

Sets the vertical scale of emitted particles.

Parameters:

Returns:
Description:

This Particle Emitter.

Examples:
Focus
Focus
setScrollFactor(x, [y])
Focus
Focus

Description:

Sets the scroll factor of this Game Object.

The scroll factor controls the influence of the movement of a Camera upon this Game Object.

When a camera scrolls it will change the location at which this Game Object is rendered on-screen. It does not change the Game Objects actual position values.

A value of 1 means it will move exactly in sync with a camera. A value of 0 means it will not move at all, even if the camera moves. Other values control the degree to which the camera movement is mapped to this Game Object.

Please be aware that scroll factor values other than 1 are not taken in to consideration when calculating physics collisions. Bodies always collide based on their world position, but changing the scroll factor is a visual adjustment to where the textures are rendered, which can offset them from physics bodies if not accounted for in your code.

Parameters:

name type arguments Default description
x number

The horizontal scroll factor of this Game Object.

y number <optional> x

The vertical scroll factor of this Game Object. If not set it will use the x value.

Returns:
Description:

This Game Object instance.

Inherited from: Phaser.GameObjects.Components.ScrollFactor#setScrollFactor
Examples:
Since: 3.0.0
Focus
Focus
setSpeed(value)
Focus
Focus

Description:

Sets the initial radial speed of emitted particles. Changes the emitter to radial mode.

Parameters:

name type description
value Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType

The speed, in pixels per second.

Returns:
Description:

This Particle Emitter.

Examples:
Focus
Focus
setSpeedX(value)
Focus
Focus

Description:

Sets the initial horizontal speed of emitted particles. Changes the emitter to point mode.

Parameters:

name type description
value Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType

The speed, in pixels per second.

Returns:
Description:

This Particle Emitter.

Examples:
Focus
Focus
setSpeedY(value)
Focus
Focus

Description:

Sets the initial vertical speed of emitted particles. Changes the emitter to point mode.

Parameters:

name type description
value Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType

The speed, in pixels per second.

Returns:
Description:

This Particle Emitter.

Examples:
Focus
Focus
setTint(value)
Focus
Focus

Description:

Sets the color tint of emitted particles.

Parameters:

Returns:
Description:

This Particle Emitter.

Examples:
Since: 3.22.0
Focus
Focus
setVisible(value)
Focus
Focus

Description:

Sets the visibility of this Game Object.

An invisible Game Object will skip rendering, but will still process update logic.

Parameters:

name type description
value boolean

The visible state of the Game Object.

Returns:
Description:

This Game Object instance.

Inherited from: Phaser.GameObjects.Components.Visible#setVisible
Examples:
Since: 3.0.0
Focus
Focus
start()
Focus
Focus

Description:

Turns Phaser.GameObjects.Particles.ParticleEmitter#on the emitter and resets the flow counter.

If this emitter is in flow mode (frequency >= 0; the default), the particle flow will start (or restart).

If this emitter is in explode mode (frequency = -1), nothing will happen. Use Phaser.GameObjects.Particles.ParticleEmitter#explode or Phaser.GameObjects.Particles.ParticleEmitter#flow instead.

Returns:
Description:

This Particle Emitter.

Examples:
Focus
Focus
startFollow(target, [offsetX], [offsetY], [trackVisible])
Focus
Focus

Description:

Continuously moves the particle origin to follow a Game Object's position.

Parameters:

name type arguments Default description
target Phaser.GameObjects.GameObject

The Game Object to follow.

offsetX number <optional> 0

Horizontal offset of the particle origin from the Game Object.

offsetY number <optional> 0

Vertical offset of the particle origin from the Game Object.

trackVisible boolean <optional> false

Whether the emitter's visible state will track the target's visible state.

Returns:
Description:

This Particle Emitter.

Examples:
Focus
Focus
stop()
Focus
Focus

Description:

Turns off the emitter.

Returns:
Description:

This Particle Emitter.

Examples:
Since: 3.11.0
Focus
Focus
stopFollow()
Focus
Focus

Description:

Stops following a Game Object.

Returns:
Description:

This Particle Emitter.

Examples:
Focus
Focus
toJSON([output])
Focus
Focus

Description:

Creates a description of this emitter suitable for JSON serialization.

Parameters:

name type arguments description
output object <optional>

An object to copy output into.

Returns:
Description:
  • The output object.
Type:
  • object
Examples:
Focus
Focus