@newkrok/three-particles - v2.16.1
    Preparing search index...

    Type Alias ParticleSystem

    Represents a particle system instance, providing methods to control and manage its lifecycle.

    const particleSystem: ParticleSystem = {
    instance: new THREE.Points(geometry, material),
    resumeEmitter: () => { /* resume logic * / },
    pauseEmitter: () => { /* pause logic * / },
    dispose: () => { /* cleanup logic * / },
    };

    particleSystem.pauseEmitter(); // Stop particle emission
    particleSystem.resumeEmitter(); // Resume particle emission
    particleSystem.dispose(); // Cleanup the particle system
    type ParticleSystem = {
        computeNode: unknown | null;
        dispose: () => void;
        instance: THREE.Points | THREE.Mesh;
        pauseEmitter: () => void;
        resumeEmitter: () => void;
        update: (cycleData: CycleData) => void;
        updateConfig: (config: Partial<ParticleSystemConfig>) => void;
    }
    Index

    Properties

    computeNode: unknown | null

    GPU compute node for WebGPU dispatch. Call renderer.compute(computeNode) before renderer.render(). Null when CPU simulation.

    dispose: () => void

    Disposes of the particle system, cleaning up resources to free memory.

    instance: THREE.Points | THREE.Mesh

    The underlying Three.js Points or Mesh object used for particle rendering.

    pauseEmitter: () => void

    Pauses the particle emitter, stopping any new particles from being emitted.

    resumeEmitter: () => void

    Resumes the particle emitter, allowing particles to be emitted again.

    update: (cycleData: CycleData) => void
    updateConfig: (config: Partial<ParticleSystemConfig>) => void

    Updates the particle system configuration at runtime without recreating the system.

    System-level properties (gravity, force fields, noise, emission rates, color/size/opacity over lifetime curves) take effect immediately for all particles. Per-particle spawn properties (startColor, startSize, startSpeed, startLifetime, etc.) only affect newly emitted particles — already-alive particles retain their original values.

    Type Declaration

      • (config: Partial<ParticleSystemConfig>): void
      • Parameters

        • config: Partial<ParticleSystemConfig>

          A partial configuration object. Only the provided properties will be updated; all other settings remain unchanged.

        Returns void

    Structural properties that are set at creation time cannot be changed at runtime: maxParticles, renderer.rendererType, shape, and map (texture). Passing these will update the internal config but have no visible effect since the geometry and material are pre-allocated.

    const system = createParticleSystem(config);

    // Change wind direction in real time
    system.updateConfig({
    forceFields: [{ type: ForceFieldType.DIRECTIONAL, direction: { x: 1, y: 0, z: 0 }, strength: 5 }],
    });

    // Gradually change color of new particles
    system.updateConfig({
    startColor: { min: { r: 1, g: 0, b: 0 }, max: { r: 1, g: 0.5, b: 0 } },
    });