op

The steps and outputs a grid simulation is built from.

op: { wave, splat, gradient }

Import op from shaders/std.

op.wave and op.splat go in step and run in order once per frame. op.gradient goes in derive, named, and becomes an output an effect can read with sim.output('name').

Example

step: [op.wave({damping: p('decay')}), op.splat({at: pointer({teleportGuard: 'on'}), amount: pointerSpeed({max: 2}), radius: p('radius')})],
derive: {displacement: op.gradient()},

Tip. The current engine implements exactly [op.wave, op.splat] with op.gradient derived. Other combinations throw at definition time.

Members

  • op.wave — A wave step: the grid ripples outward from any disturbance and fades by damping (a prop, 0–20).
  • op.splat — A brush step: a soft round push into the grid at the pointer, scaled by how fast it moves.
  • op.gradient — A derived output: the grid's slope at every cell as a 2D vector, ready for displaceBy.

See also

  • simulate — Declare a simulation the engine runs for you.
  • GridSim — A declared grid simulation.

Used by

CursorRipples