API reference

Every public class, method, and event in @codexo/exojs. Generated from source.

I

interfaceParticleDeathContext

@codexo/exojs-particles / particles / stable

The state of one particle at the moment it expired. A snapshot, not a view: it is copied out of the simulation when the particle dies and stays valid for the whole callback, whichever backend ran the simulation and whether or not the slot has already been reused. It carries no slot index for that reason - there is nothing to read back afterwards. On the GPU backend, the death branch re-integrates `x`/`y`/`rotation`/ `elapsed` to match the CPU path exactly, but returns before running that frame's update modules - so `velocityX`/`velocityY`/`scaleX`/`scaleY`/ `color` are the PREVIOUS frame's values, one integration step stale relative to the CPU backend, which runs every module before snapshotting. A `ColorOverLifetime` particle therefore dies at its second-to-last colour on WebGPU and its final colour on WebGL2; an `ApplyForce`/`Drag` particle's reported velocity is one step behind. A `SpawnOnDeath` sub-emitter or a custom death module reading these fields sees this divergence.

10
props
0
methods
0
events
Import
import { ParticleDeathContext } from '@codexo/exojs-particles'

The state of one particle at the moment it expired.

A snapshot, not a view: it is copied out of the simulation when the particle dies and stays valid for the whole callback, whichever backend ran the simulation and whether or not the slot has already been reused. It carries no slot index for that reason - there is nothing to read back afterwards.

On the GPU backend, the death branch re-integrates `x`/`y`/`rotation`/ `elapsed` to match the CPU path exactly, but returns before running that frame's update modules - so `velocityX`/`velocityY`/`scaleX`/`scaleY`/ `color` are the PREVIOUS frame's values, one integration step stale relative to the CPU backend, which runs every module before snapshotting. A `ColorOverLifetime` particle therefore dies at its second-to-last colour on WebGPU and its final colour on WebGL2; an `ApplyForce`/`Drag` particle's reported velocity is one step behind. A `SpawnOnDeath` sub-emitter or a custom death module reading these fields sees this divergence.

Properties10
color: number
Packed 0xAABBGGRR tint at death.
elapsed: number
Seconds the particle lived.
lifetime: number
Lifetime the particle was spawned with.
rotation: number
scaleX: number
scaleY: number
velocityX: number
velocityY: number
x: number
y: number
Source