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.
#
ParametersName | Type |
---|---|
options? | EmitterConstructionOptions |
#
Defined in#
Properties#
emission• Readonly
emission: EmissionOptions
The emission options of the emitter.
#
Defined in#
options• Readonly
options: EmitterOptions
The main options of the emitter.
#
Defined in#
particles• Readonly
particles: Particle
[] = []
The particles currently contained within the system.
#
Defined in#
renderer• Readonly
renderer: RenderOptions
The renderer options of the emitter.
#
Defined in#
Accessors#
canRemove• get
canRemove(): boolean
Checks if the emitter can safely be removed. This is true if no more particles are active.
#
Returnsboolean
#
Defined in#
isExpired• get
isExpired(): boolean
Checks if the emitter is already expired and can be removed. Expired emitters do not emit new particles.
#
Returnsboolean
#
Defined in#
Methods#
clearParticlesâ–¸ clearParticles(): number
Clears all particles inside the emitter.
#
Returnsnumber
The number of cleared particles.
#
Defined in#
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.
#
ParametersName | Type | Description |
---|---|---|
delta | number | The time, in seconds, passed since the last tick. |
#
Returnsvoid