Particle Emitter Configuration

This covers the Particle Emitter configuration options, apart from the particle behaviors. Behaviors each have their own section.

The base parameters define the initial state of the particle emitter. They can be defined in any order, some are optional or have default parameters. Here’s a quick example, followed by a more detailed explanation of each parameter.

Note that all information here is from the code repository if you want to dig any deeper.

The particle emitter configuration is the second parameter passed to the Emitter constructor as below.

const emitter = new PIXI.particles.Emitter(stage, {
  lifetime: { min: 0.1, max: 3 },
  pos: { x: 327, y: 200 },
  maxParticles: 10,1
  autoUpdate: true,
});

lifetime: {min: number, max: number} Each individual particle will persist for a random amount of time, in seconds, between these two values.

ease?: {SimpleEase | EaseSegment[]} Custom easing to be applied to all interpolated values across each particle’s life. TODO demo and default.

particlesPerWave?: number Optional Number of particles spawned each time there is a particle spawn event. Defaults to 1 particle per wave.

frequency: number The time interval, in seconds second, between particle spawns. For example, a value of 0.1 will spawn a particle every 100ms, or ten times a second.

Not listed as an optional parameter, but if omitted, defaults to 1.

spawnChance?: number Optional The chance a particle spawn event generates particles. A spawnChance of 0 means there will be no particles spawned at any spawn event, a value of 1 means particles will be spawned at each spawn event.

Defaults to spawnChance of 1.

emitterLifetime?: number Optional The number of seconds the emitter keeps emitting.

Defaults to run forever unless manually stopped.

maxParticles?: number Optional The maximum number of particles that can be alive at any point for this emitter. If the limit is reached the emitter will stop spawning particles until some have died.

Defaults to no maximum number.

addAtBack?: boolean Optional If true, particles will be added at the back of the display list. This can help avoid the effect of particles popping into existence.

Defaults to false.

pos: {x: number, y: number}

Defines the spawn origin point from inside the particle emitter – it’s x and y spawn position relative to the parent container.

Not listed as optional, but defaults to {x: 0, y: 0}

emit?: boolean Optional Whether the emitter starts emitting particles immediately after being created.

Defaults to true.

autoUpdate?: boolean Optional Whether the emitter automagically ties to PixiJS’s shared ticker.

Defaults to false, meaning you will be responsible for connecting the emitter to update on ticks.

behaviors: Behavior[] An array of particle behaviors. Behaviors are covered per behavior on their own pages.

PixiJS Particle Emitter: The Unauthorized Manual