babylon.quarks - v0.19.0
    Preparing search index...

    Interface Behavior

    Interface for particle behaviors. a behavior is a function that modifies a particle's properties over time.

    interface Behavior {
        type: string;
        clone(): Behavior;
        frameUpdate(delta: number): void;
        initialize(particle: Particle, particleSystem: IParticleSystem): void;
        reset(): void;
        toJSON(): any;
        update(particle: Particle, delta: number): void;
        updateAll?(particles: Particle[], count: number, delta: number): void;
    }

    Implemented by

    Index

    Properties

    type: string

    Methods

    • Returns Behavior

    • Parameters

      • delta: number

      Returns void

    • Returns void

    • Returns any

    • Parameters

      Returns void

    • Optional bulk form of update, applied to particles[0..count).

      The per-particle update is reached through one call site shared by every behavior type, which leaves it megamorphic: V8 can neither inline it nor specialise the generator calls inside. A behavior that implements this instead gets one call per frame and a loop it owns, where those calls are monomorphic. Implementations must skip dead particles exactly as the per-particle path does, and must produce identical results.

      Behaviors that do not implement it keep working unchanged.

      Parameters

      • particles: Particle[]
      • count: number
      • delta: number

      Returns void