Constructor
new DirectionalForce(configopt)
- Description:
- Initializes a directional force with horizontal and vertical acceleration components.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
config |
DirectionalForceConfig |
<optional> |
{}
|
DirectionalForce configuration options. |
Extends
Classes
Members
ax :number
- Description:
- Current horizontal acceleration component (in pixels per second).
- Source:
Current horizontal acceleration component (in pixels per second).
Type:
- number
ay :number
- Description:
- Current vertical acceleration component (in pixels per second).
- Source:
Current vertical acceleration component (in pixels per second).
Type:
- number
id :string
- Description:
- Unique identifier. Defaults to a generated UUID.
- Source:
- Overrides:
Unique identifier. Defaults to a generated UUID.
Type:
- string
Methods
apply(particle, dt) → {void}
- Description:
- Changes a particle's velocity based on the force's horizontal and vertical acceleration.
- Source:
- Overrides:
Parameters:
| Name | Type | Description |
|---|---|---|
particle |
Particle | Particle instance to affect. |
dt |
number | Time elapsed since the last frame (in seconds). |
Throws:
Error
Returns:
- Type
- void