op.seedOnce
A one-shot reset run before the rest of the frame whenever staleWhen says the state is stale: on the first frame, or when a seed prop changes.
op.seedOnce(opts: {pass: ComputeStep; staleWhen: (f: GridFrame) => boolean; onSeed?: () => void}): GridStage
Import sim from shaders/std and use sim.grids.op.seedOnce.
Parameters
| Name | Type | Notes |
|---|---|---|
opts | {pass: ComputeStep; staleWhen: (f: GridFrame) => boolean; onSeed?: () => void} |
Example
op.seedOnce({pass: seed, staleWhen: () => needsSeed, onSeed: () => { needsSeed = false }})
See also
op.iterate— Run a stepcounttimes this frame.