LinearDrag

LinearDrag

Environmental force that applies linear drag (friction) to slow down particles over time.

Constructor

new LinearDrag(configopt)

Description:
  • Initializes a linear drag with a specified friction coefficient.
Source:
Parameters:
Name Type Attributes Default Description
config LinearDragConfig <optional>
{} LinearDrag configuration options.

Extends

Classes

LinearDrag

Members

drag :number

Description:
  • Friction coefficient where 0 means no drag and higher values slow particles down faster.
Source:
Friction coefficient where 0 means no drag and higher values slow particles down faster.
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:
  • Reduces a particle's velocity over time using linear damping.
Source:
Overrides:
Parameters:
Name Type Description
particle object Particle instance to affect.
dt number Time elapsed since the last frame (in seconds).
Throws:
Error
Returns:
Type
void