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#
| Name | 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.
Returns#
boolean
Defined in#
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#
Methods#
clearParticles#
â–¸ clearParticles(): number
Clears all particles inside the emitter.
Returns#
number
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.
Parameters#
| Name | Type | Description |
|---|---|---|
delta | number | The time, in seconds, passed since the last tick. |
Returns#
void