babylon.quarks - v1.0.0
    Preparing search index...

    Interface IParticleSystem

    What the simulation core needs of a particle system: its emission, particles, transform and lifecycle. babylon.quarks' ParticleSystem implements it.

    interface IParticleSystem {
        duration: number;
        emissionState: EmissionState;
        emitter: IEmitter;
        emitterVelocity?: Vector3;
        flip?: Vector2Like;
        isDisposed?: boolean;
        isEmitEnded: boolean;
        looping: boolean;
        motionScale?: number;
        onlyUsedByOther?: boolean;
        particleNum: number;
        particles: IParticle[];
        paused: boolean;
        rendererEmitterSettings: RendererEmitterSettings;
        ringBufferActive?: boolean;
        simulationResidual?: number;
        simulationStep?: number;
        stopAction?: "none" | "disable" | "destroy";
        worldSpace: boolean;
        addEventListener(
            event: ParticleSystemEventType,
            callback: (event: ParticleSystemEvent) => void,
        ): void;
        clone(): IParticleSystem;
        emit(delta: number, subEmissionState: EmissionState, matrix: Matrix4): void;
        endEmit(): void;
        hasPendingEmission(state?: EmissionState): boolean;
        isFinished(): boolean;
        pause(): void;
        play(): void;
        removeAllEventListeners(event?: ParticleSystemEventType): void;
        removeEventListener(
            event: ParticleSystemEventType,
            callback: (event: ParticleSystemEvent) => void,
        ): void;
        restart(): void;
        stop(): void;
        toJSON(metaData: unknown): unknown;
    }

    Implemented by

    Index
    duration: number

    Duration of the system.

    emissionState: EmissionState

    Emission progress: time in the cycle, burst and distance counters.

    emitter: IEmitter

    Emitter for the particles.

    emitterVelocity?: Vector3

    World-space velocity of the emitter, updated each frame by the runtime.

    Fraction of billboard particles mirrored along U (x) and V (y), each picked at random when the particle is born — Unity's renderer Flip. Absent: nothing is mirrored.

    isDisposed?: boolean

    Whether the system has been disposed. A disposed system takes no more particles, so a sub emitter aimed at it emits nothing.

    isEmitEnded: boolean

    True after endEmit() — emission window closed (non-looping duration elapsed).

    looping: boolean

    Whether the system is looping.

    motionScale?: number

    What world-space forces are multiplied by: the mean scale of IEmitter.matrixWorld's axes for a world-space system, which carries what its scaling mode scales motion by; 1 or undefined otherwise.

    onlyUsedByOther?: boolean

    Whether this system only emits through another system, which is when its particles carry their own parent transform.

    particleNum: number

    Number of particles.

    particles: IParticle[]

    Array of particles.

    paused: boolean

    True while paused: the system is not simulated.

    rendererEmitterSettings: RendererEmitterSettings

    Settings of the renderer that draws the particles, such as the trail or beam setup.

    ringBufferActive?: boolean

    Whether particles outlive their lifetime: held or looped at the end of it until new ones replace them, as with Unity's Ring Buffer Mode on a full system. A Death sub emitter does not fire for them, since they do not die.

    simulationResidual?: number

    Wall-clock time that has passed since the last simulated step, in seconds, when the implementation simulates on a fixed timestep. Negative when that step ran a hair ahead of real time instead (rounded to the nearest step rather than floored, so this stays small either way). A renderer uses it to draw where the particles are now rather than where the last step left them.

    simulationStep?: number

    Length of one simulation step, in seconds, when the implementation simulates on a fixed timestep. Turning is recorded per step rather than per second, so a renderer needs this to know what fraction of a step simulationResidual is.

    stopAction?: "none" | "disable" | "destroy"

    What the system does once it has finished, as Unity's Stop Action: nothing ('none'), disable its emitter ('disable') or dispose itself ('destroy'). Undefined is 'none'.

    worldSpace: boolean

    Whether the system is in world space.

    • A new system with the same settings, behaviors and generators.

      Returns IParticleSystem

    • Spawns what delta seconds of emission call for, on subEmissionState from the emitter at matrix; how a sub emitter target emits for a parent particle.

      Parameters

      Returns void

    • Stops emission and lets the particles alive die out; fires 'emitEnd'.

      Returns void

    • Whether more particles can still spawn (bursts, rate, distance): from the system's own emission, or with state from one a sub emitter runs into it for a parent particle.

      Parameters

      Returns boolean

    • Non-looping system with no live particles and no pending emission.

      Returns boolean

    • Freezes the system where it is until IParticleSystem.play.

      Returns void

    • Resumes a paused system.

      Returns void

    • Removes every callback registered for event, or every callback when it is left out.

      Parameters

      Returns void

    • Clears every particle and plays the system again from the start.

      Returns void

    • Clears every particle, rewinds to the start and pauses.

      Returns void

    • Writes the system's settings, putting its shared resources into metaData; the shapes of both are the renderer's.

      Parameters

      • metaData: unknown

      Returns unknown