Skip to main content

Overview

The SDK provides two approaches to particles:
  • <ParticleEmitter> — high-level emitter backed by @barvynkoa/particle-emitter. Driven by a JSON config and a spritesheet asset key.
  • <ParticleContainer> + <Particles> — lower-level approach using PixiJS’s native PIXI.ParticleContainer. You control initialisation and per-frame update logic directly.

<ParticleEmitter>

A declarative particle emitter. Reads its texture from stateApp.loadedAssets using key, upgrades the config to the latest format, and drives the emitter on the PixiJS ticker. The emitter is destroyed automatically when the component is unmounted.

Props

string
required
Asset manifest key for the particle spritesheet (type: 'spriteSheet'). The loaded texture array is passed to the emitter config automatically.
EmitterConfigV3 | EmitterConfigV2 | EmitterConfigV1
required
The particle emitter configuration object. All three config versions from @barvynkoa/particle-emitter are accepted — the SDK upgrades older formats automatically via upgradeConfig.
boolean
When true, reinitialises the emitter with the current config. Toggle this to trigger a burst or restart emission. Synced from Emitter.emit.
number
A multiplier applied to ticker.deltaMS before calling emitter.update(). Controls the effective simulation speed. Default 0.00234.
number
Probability (0–1) that a particle will spawn on any given update. Inherited from Emitter. Default 1.
number
Maximum number of live particles at any time. Inherited from Emitter.
typeof Particle
Custom particle class constructor. Inherited from Emitter.

Emitter config

The config prop accepts the EmitterConfigV3 format from @barvynkoa/particle-emitter. Key fields:

Example


<ParticleContainer>

A wrapper around PIXI.ParticleContainer that provides the particle parent context to child <Particles> components. More performant than a regular <Container> for large numbers of identical sprites.

Props

Snippet
required
One or more <Particles> components.
Partial<PIXI.ParticleContainerProperties>
An object specifying which properties (vertices, position, rotation, uvs, tint) are updated per particle. Enabling more properties increases GPU upload cost. From PIXI.ParticleContainerOptions.
number
Maximum number of particles. Must be set at creation time. From PIXI.ParticleContainerOptions.
number
Number of particles per draw call batch. From PIXI.ParticleContainerOptions.
boolean
Whether the container automatically resizes to accommodate more particles than maxSize. From PIXI.ParticleContainerOptions.
number
Horizontal position. Default 0.
number
Vertical position. Default 0.
number
Opacity. Default 1.
boolean
Whether the container is rendered. Default true.
number
Sort order within the parent. Default 0.
Cursor
CSS cursor string.

<Particles>

A low-level particle layer. Creates size PIXI.Particle instances using a texture resolved from stateApp.loadedAssets, calls init once on mount, and calls update on every PixiJS ticker tick. Must be a child of <ParticleContainer>.

Props

string
required
Asset manifest key for a sprite asset. The loaded texture is applied to every particle instance.
number
required
The number of PIXI.Particle instances to create.
(particles: PIXI.Particle[]) => void
required
Called once after the particles are created. Set initial positions, scales, alphas, velocities, etc.
(particles: PIXI.Particle[]) => void
required
Called every frame via the PixiJS ticker. Mutate each particle’s properties to simulate motion, fade, etc. The ParticleContainer is updated automatically after this callback.

Example

<Particles> adds particles to the ParticleContainer at mount time and never removes them. To hide unused particles, set alpha = 0 in your update function rather than removing them.