Audio · function
smoothToward
Exponential approach, in time.
Explained in Your first game.
function smoothToward(current: number, target: number, rate: number, dtSec: number): numberimport { smoothToward } from '@driftengine/audio';Parameters
| Parameter | Type | Description |
|---|---|---|
current | number | |
target | number | |
rate | number | |
dtSec | number |
In depth
rate is per second and means the same thing at 60 Hz, at 144 Hz and at whatever a background
tab does. A per-step factor is the bug AGENTS.md records: the same constant meant 47 ms in one
caller and 158 ms in another, and moved with the frame rate in the second.