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 . Zones . EdgeZone

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 . Zones . EdgeZone

A zone that places particles on a shape's edges.

Constructor:

new EdgeZone(source, quantity, stepRate, [yoyo], [seamless])

Parameters:

name type arguments Default description
source Phaser.Types.GameObjects.Particles.EdgeZoneSource

An object instance with a getPoints(quantity, stepRate) method returning an array of points.

quantity number

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

stepRate number

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.

Since: 3.0.0

Members

<private> _direction: number
Focus
Focus

Description:

An internal value used to keep track of the current iteration direction for the EdgeZone's points.

0 = forwards, 1 = backwards

Type:
number
Default: 0
Since: 3.0.0
Focus
Focus
<private> _length: number
Focus
Focus

Description:

An internal count of the points belonging to this EdgeZone.

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

Description:

The counter used for iterating the EdgeZone's points.

Type:
number
Default: -1
Since: 3.0.0
Focus
Focus
points: Array.<Phaser.Geom.Point>
Focus
Focus

Description:

The points placed on the source edge.

Type:
Default: []
Since: 3.0.0
Focus
Focus
quantity: number
Focus
Focus

Description:

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

Type:
number
Since: 3.0.0
Focus
Focus
seamless: boolean
Focus
Focus

Description:

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

Type:
boolean
Since: 3.0.0
Focus
Focus
stepRate: number
Focus
Focus

Description:

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

Type:
number
Since: 3.0.0
Focus
Focus
yoyo: boolean
Focus
Focus

Description:

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

Type:
boolean
Since: 3.0.0
Focus
Focus

Methods

changeSource(source)
Focus
Focus

Description:

Change the source of the EdgeZone.

Parameters:

name type description
source Phaser.Types.GameObjects.Particles.EdgeZoneSource

An object instance with a getPoints(quantity, stepRate) method returning an array of points.

Returns:
Description:

This Edge Zone.

Examples:
Since: 3.0.0
Focus
Focus
getPoint(particle)
Focus
Focus

Description:

Get the next point in the Zone and set its coordinates on the given Particle.

Parameters:

name type description
particle Phaser.GameObjects.Particles.Particle

The Particle.

Examples:
Since: 3.0.0
Focus
Focus
updateSource()
Focus
Focus

Description:

Update the Phaser.GameObjects.Particles.Zones.EdgeZone#points from the EdgeZone's Phaser.GameObjects.Particles.Zones.EdgeZone#source.

Also updates internal properties.

Returns:
Description:

This Edge Zone.

Examples:
Since: 3.0.0
Focus
Focus