Skip to main content

Class: Emitter

index.Emitter

Represents an emitter that is responsible for spawning and updating particles.

Particles themselves are just data-holders, with the system acting upon them and modifying them. The modifications are done mainly via modules, that use the particle's data together with some function to apply temporal transitions.

see Particle

see ParticleModifierModule

Constructors#

constructor#

new Emitter(options?)

Creates a new emitter, using default options.

Parameters#

NameType
options?EmitterConstructionOptions

Defined in#

particles/emitter.ts:74

Properties#

emission#

Readonly emission: EmissionOptions

The emission options of the emitter.

Defined in#

particles/emitter.ts:47


options#

Readonly options: EmitterOptions

The main options of the emitter.

Defined in#

particles/emitter.ts:43


particles#

Readonly particles: Particle[] = []

The particles currently contained within the system.

Defined in#

particles/emitter.ts:38


renderer#

Readonly renderer: RenderOptions

The renderer options of the emitter.

Defined in#

particles/emitter.ts:51

Accessors#

canRemove#

get canRemove(): boolean

Checks if the emitter can safely be removed. This is true if no more particles are active.

Returns#

boolean

Defined in#

particles/emitter.ts:72


isExpired#

get isExpired(): boolean

Checks if the emitter is already expired and can be removed. Expired emitters do not emit new particles.

Returns#

boolean

Defined in#

particles/emitter.ts:63

Methods#

clearParticles#

clearParticles(): number

Clears all particles inside the emitter.

Returns#

number

The number of cleared particles.

Defined in#

particles/emitter.ts:99


tick#

tick(delta): void

Processes a tick of the emitter, using the elapsed time.

remarks This handles a few things, namely:

  • Incrementing the duration timer and potentially incrementing the loop.
  • Handling particle bursts & emissions.
  • Despawning particles conditionally.

Parameters#

NameTypeDescription
deltanumberThe time, in seconds, passed since the last tick.

Returns#

void

Defined in#

particles/emitter.ts:114