Constructor
(abstract) new Emitter(configopt)
- Description:
- Initializes a particle emitter.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
config |
EmitterConfig |
<optional> |
{}
|
Emitter configuration options. |
Throws:
TypeError
Classes
Members
duration :number
- Description:
- Duration of particle emission (in seconds), where -1 represents infinite emission.
- Source:
Duration of particle emission (in seconds), where -1 represents infinite emission.
Type:
- number
enabled :boolean
- Description:
- Flag indicating whether the emitter is running or not.
- Source:
Flag indicating whether the emitter is running or not.
Type:
- boolean
id :string
- Description:
- Unique identifier. Defaults to a generated UUID.
- Source:
Unique identifier. Defaults to a generated UUID.
Type:
- string
looping :boolean
- Description:
- Flag indicating whether a finite-duration emitter restarts when its time is up.
- Source:
Flag indicating whether a finite-duration emitter restarts when its time is up.
Type:
- boolean
particlesPerSecond :number
- Description:
- Continuous emission rate of new particles per second.
- Source:
Continuous emission rate of new particles per second.
Type:
- number
x :number
- Description:
- Current horizontal coordinate of the emitter origin.
- Source:
Current horizontal coordinate of the emitter origin.
Type:
- number
y :number
- Description:
- Current vertical coordinate of the emitter origin.
- Source:
Current vertical coordinate of the emitter origin.
Type:
- number
Methods
addModifier(modifier) → {void}
- Description:
- Registers a modifier to be applied to the particles emitted by the emitter.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
modifier |
Modifier | Modifier instance to register. |
Returns:
- Type
- void
addScopedForce(force) → {void}
- Description:
- Registers a scoped emitter-specific force to be applied to the particles emitted by the emitter.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
force |
Force | Force instance to register. |
Returns:
- Type
- void
initParticle(particle) → {void}
- Description:
- Sets up a particle's movement, visuals, and lifecycle state.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
particle |
Particle | Particle instance to initialize. |
Returns:
- Type
- void
update(dt) → {Array.<Particle>}
- Description:
- Updates the emitter's internal timer and returns any new particles to be emitted in the current frame.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
dt |
number | Time elapsed since the last frame (in seconds). |
Returns:
An array of particles emitted this frame.
- Type
- Array.<Particle>