Constructor
new EllipseEmitter(configopt)
- Description:
- Initializes an ellipse emitter with a given position and radius. Particles are emitted randomly from the elliptical area using a uniform distribution.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
config |
EllipseEmitterConfig |
<optional> |
{}
|
EllipseEmitter configuration options. |
Extends
Classes
Members
emissionSource :string
- Description:
- Emission source mode, defining the geometric distribution and initial direction of emitted particles. The default direction depends on both the emission source mode and the emitter type and can be overridden by specifying `particleBlueprint.direction` in the emitter config.
- Source:
- Overrides:
- See:
-
- EmissionSourceValues for available configuration constants.
Emission source mode, defining the geometric distribution and initial direction of emitted particles.
The default direction depends on both the emission source mode and the emitter type and can be overridden by specifying
`particleBlueprint.direction` in the emitter config.
Type:
- string
particlesPerSecond :number
- Description:
- Continuous emission rate of new particles per second.
- Source:
- Overrides:
Continuous emission rate of new particles per second.
Type:
- number
radiusX :number
- Description:
- Horizontal radius of the emission ellipse.
- Source:
Horizontal radius of the emission ellipse.
Type:
- number
radiusY :number
- Description:
- Vertical radius of the emission ellipse.
- Source:
Vertical radius of the emission ellipse.
Type:
- number
x :number
- Description:
- Horizontal coordinate of the emission ellipse center.
- Source:
- Overrides:
Horizontal coordinate of the emission ellipse center.
Type:
- number
y :number
- Description:
- Vertical coordinate of the emission ellipse center.
- Source:
- Overrides:
Vertical coordinate of the emission ellipse center.
Type:
- number
Methods
addModifier(modifier) → {void}
- Description:
- Registers a modifier to be applied to the particles emitted by the emitter.
- Source:
- Overrides:
Parameters:
| Name | Type | Description |
|---|---|---|
modifier |
Modifier | Modifier instance to register. |
Throws:
Error
Returns:
- Type
- void
addScopedForce(force) → {void}
- Description:
- Registers a scoped emitter-specific force to be applied to the particles emitted by the emitter.
- Source:
- Overrides:
Parameters:
| Name | Type | Description |
|---|---|---|
force |
Force | Force instance to register. |
Returns:
- Type
- void
getModifier(id) → {Modifier|null}
- Description:
- Finds a registered modifier by its unique identifier.
- Source:
- Overrides:
Parameters:
| Name | Type | Description |
|---|---|---|
id |
string | The unique identifier of the target modifier. |
Returns:
The modifier instance if found, null otherwise.
- Type
- Modifier | null
getScopedForce(id) → {Force|null}
- Description:
- Finds a registered scoped emitter-specific force by its unique identifier.
- Source:
- Overrides:
Parameters:
| Name | Type | Description |
|---|---|---|
id |
string | The unique identifier of the target force. |
Returns:
The force instance if found, null otherwise.
- Type
- Force | null
pause() → {void}
- Description:
- Temporarily halts particle emission and locks internal tracking.
- Source:
- Overrides:
Returns:
- Type
- void
removeModifier(id) → {boolean}
- Description:
- Removes a modifier from any of the emitter's registered modifier lists by its unique identifier.
- Source:
- Overrides:
Parameters:
| Name | Type | Description |
|---|---|---|
id |
string | The unique identifier of the target modifier. |
Returns:
True if found and successfully removed, false otherwise.
- Type
- boolean
removeScopedForce(id) → {boolean}
- Description:
- Removes a scoped emitter-specific force from the emitter's registered forces lists by its unique identifier.
- Source:
- Overrides:
Parameters:
| Name | Type | Description |
|---|---|---|
id |
string | The unique identifier of the target force. |
Returns:
True if found and successfully removed, false otherwise.
- Type
- boolean
resume() → {void}
- Description:
- Resumes particle emission and internal tracking from where they were paused.
- Source:
- Overrides:
Returns:
- Type
- void
start() → {void}
- Description:
- Starts or forcefully restarts particle emission from the beginning. Resets internal tracking and sets the emitter to an active state.
- Source:
- Overrides:
Returns:
- Type
- void
stop() → {void}
- Description:
- Halts particle emission and resets internal tracking. The emitter is deactivated but remains ready to be started again.
- Source:
- Overrides:
Returns:
- Type
- void
update(dt, particlePool) → {void}
- Description:
- Updates the emitter's internal timer and returns any new particles to be emitted in the current frame.
- Source:
- Overrides:
Parameters:
| Name | Type | Description |
|---|---|---|
dt |
number | Time elapsed since the last frame (in seconds). |
particlePool |
Array.<Particle> | Reference to the internal collection of active particles in the main {Gnist} class. |
Returns:
- Type
- void