three-nebula API
    Preparing search index...

    Class Emitter

    Emitters are the System engine's particle factories. They cause particles to be rendered by emitting them, and store all particle initializers and behaviours.

    Hierarchy (View Summary)

    Index
    acceleration: Vector3D
    age: number
    alpha: number
    behaviours: Behaviour[]
    bindEmitter: boolean
    bindEmitterEvent: boolean
    body: unknown
    cID: number
    color: RGB
    currentEmitTime: number
    damping: number
    dead: boolean
    distanceToCamera: number
    emitterBehaviours: Behaviour[]
    energy: number
    eventDispatcher: EventDispatcher
    hasBeenInitialized?: boolean
    id: string
    index?: number
    initializers: Initializer[]
    isEmitting: boolean
    life: number
    mass: number
    name: string
    old: { acceleration: Vector3D; position: Vector3D; velocity: Vector3D }
    parent: Emitter | System | null
    particles: Particle[]
    position: Vector3D
    radius: number
    rate: Rate
    rotation: Vector3D
    scale: number
    sleep: boolean
    target?: unknown
    totalEmitTimes: number
    transform: Record<string, unknown>
    type: string
    useAlpha: boolean
    useColor: boolean
    velocity: Vector3D
    • get system(): System | null

      An emitter's parent is the System it was added to (a particle's parent is its emitter, hence the inherited parent field is narrowed here).

      Returns System | null

    • Adds a particle initializer to the emitter.

      Parameters

      • initializer: Initializer

      Returns this

    • Adds multiple particle initializers to the emitter.

      Parameters

      • initializers: Initializer[]

      Returns this

    • Adds the event listener for the EMITTER_DEAD event.

      Parameters

      • onEmitterDead: () => void

      Returns this

    • Proxy method for the internal event dispatcher's dispatchEvent method.

      Parameters

      • event: string
      • target: unknown = ...

      Returns void

    • Sets the total number of times the emitter should emit particles as well as the emitter's life. Also intializes the emitter rate. This enables the emitter to emit particles.

      Parameters

      • totalEmitTimes: number | "once" = Infinity
      • life: number = Infinity

      Returns this

    • Experimental emit method that is designed to be called from the System.emit method.

      Returns this

    • Runs the integration algorithm on the emitter and all particles.

      Parameters

      • time: number

      Returns void

    • Removes an initializer from the emitter's initializers array.

      Parameters

      • initializer: Initializer

      Returns this

    • Resets the particle's default properties and clears its position, velocity, acceleration, color and rotation.

      Returns this

    • Sets the emitter's particle initializers.

      Parameters

      • initializers: Initializer[]

      Returns this

    • Sets the life of the emitter.

      Parameters

      • life: number = Infinity

      Returns this

    • Sets the position of the emitter.

      Parameters

      • newPosition: Vector3Props = {}

      Returns this

    • Sets the rotation of the emitter.

      Parameters

      • newRotation: Vector3Props = {}

      Returns this

    • Sets the total emit times for the emitter.

      Parameters

      • totalEmitTimes: number = Infinity

      Returns this

    • Sets up a particle by running all initializers on it and setting its behaviours. Also adds the particle to this.particles.

      Parameters

      • particle: Particle
      • Optionalindex: number

      Returns void

    • Updates the emitter according to the time passed by calling the generate and integrate methods.

      Parameters

      • time: number

      Returns void

    • Updates the emitter's emitter behaviours.

      Parameters

      • time: number

      Returns void