op.settle
Sleep the simulation once nothing has driven it for settleMs of simulated time.
op.settle(opts: {activeWhen: (f: GridFrame) => boolean; settleMs: (f: GridFrame) => number}): GridStage
Import sim from shaders/std and use sim.grids.op.settle.
Frames are skipped and the last published texture stays on screen, so a still field costs nothing.
activeWhen says whether something drove the field this frame. settleMs is how long the field takes to fade after the last activity, in milliseconds.
Parameters
| Name | Type | Notes |
|---|---|---|
opts | {activeWhen: (f: GridFrame) => boolean; settleMs: (f: GridFrame) => number} |
Example
op.settle({activeWhen: () => moving, settleMs: (f) => 4000 / Math.max(f.num('decay', 1), 0.1)})
Tip. Simulated time, not wall-clock: a hidden tab does not count, so the field is still fading when the user comes back.
See also
op.host— A named step that runs before any gate: pointer smoothing, activity flags, anything a latersettleneeds to know.