API reference
Every public class, method, and event in @codexo/exojs. Generated from source.
classTrailParticles
A motion trail behind every particle: each one drags a strip through the positions it recently occupied, and all of them are drawn in a single non-instanced draw. Where `RibbonParticles` connects the particles of one system into one band, this connects each particle to its own past - the shape a swarm of sparks, tracer rounds or comet debris wants, where every element needs its own streak. Layout of the per-vertex buffer build fills (20 bytes, 3 attributes): ``` a_position f32x2 (offset 0, 8 bytes) strip vertex (system-local) a_texcoord f32x2 (offset 8, 8 bytes) u along the trail, v across it a_color u8x4 (offset 16, 4 bytes) RGBA tint, alpha faded by age ``` **History is recorded on the particle's own clock.** A position is appended to a particle's ring buffer once its age has advanced by TrailParticlesOptions.interval, so a trail covers the same span of travel whatever the frame rate; the live position is always drawn as the head, which keeps the strip attached to the particle between two samples. **One instance per system.** The history is per-particle state carried across frames and addressed by simulation slot, so two systems sharing one instance would overwrite each other's trails. **The strips are built on the CPU**, so this mode is not GPU-eligible and a system using it stays on the CPU simulation path (observable through `ParticleSystem.gpuMode`). That is also what lets the history survive a death: CPU-mode slots are dense and compaction copies survivors forward stably, which is what build re-aligns the history rows against. It identifies a particle by its age and its lifetime, so an update module that rewrites a live particle's lifetime restarts that particle's trail.
import { TrailParticles } from '@codexo/exojs-particles'A motion trail behind every particle: each one drags a strip through the positions it recently occupied, and all of them are drawn in a single non-instanced draw.
Where `RibbonParticles` connects the particles of one system into one band, this connects each particle to its own past - the shape a swarm of sparks, tracer rounds or comet debris wants, where every element needs its own streak.
Layout of the per-vertex buffer build fills (20 bytes, 3 attributes):
``` a_position f32x2 (offset 0, 8 bytes) strip vertex (system-local) a_texcoord f32x2 (offset 8, 8 bytes) u along the trail, v across it a_color u8x4 (offset 16, 4 bytes) RGBA tint, alpha faded by age ```
**History is recorded on the particle's own clock.** A position is appended to a particle's ring buffer once its age has advanced by TrailParticlesOptions.interval, so a trail covers the same span of travel whatever the frame rate; the live position is always drawn as the head, which keeps the strip attached to the particle between two samples.
**One instance per system.** The history is per-particle state carried across frames and addressed by simulation slot, so two systems sharing one instance would overwrite each other's trails.
**The strips are built on the CPU**, so this mode is not GPU-eligible and a system using it stays on the CPU simulation path (observable through `ParticleSystem.gpuMode`). That is also what lets the history survive a death: CPU-mode slots are dense and compaction copies survivors forward stably, which is what build re-aligns the history rows against. It identifies a particle by its age and its lifetime, so an update module that rewrites a live particle's lifetime restarts that particle's trail.
new(options: TrailParticlesOptionsConstruction options for TrailParticles.): TrailParticles_ensureCapacity(byteLength: number): void_onBufferGrown(data: ArrayBuffer): void_setCount(count: number): voidbuild(_system: ParticleSystemThe central coordinator of the particle pipeline. `ParticleSystem` is a Drawable that owns: - **Particle storage** - one channel per attribute (position, veloc…, particles: ParticleBatchThe live particles of one system, addressed by semantic channel. This is the bulk surface an UpdateModule and a ParticleRenderMode operate on. Channels are nam…): voiddestroy(): voidfloatsPerVertex: numbergpuEligible: booleaninstanced: falsecount: numberdata: ArrayBuffer