springLatticeField
A cloth of springs the cursor pushes: it stretches, rings and settles like fabric.
springLatticeField(slots: {
stiffness: PropRef
damping: PropRef
radius: PropRef
output: string
}): (params: GpuFragmentParams, root: GridRoot) => GridSimConfig
Import effects from shaders/std and use effects.pointerFields.springLatticeField.
Spread it with ...sim.grids.gridSim(...). stiffness (about 1 to 30) is how rigid the cloth is; damping (about 0 to 10) how quickly it stops moving; radius the push area (1 is about 8% of the canvas). The grid is fixed at 64 cells per side. The field is published under output for a warp map such as warps.liquidDisplace.
Parameters
| Name | Type | Notes |
|---|---|---|
slots | `{ |
stiffness: PropRef
damping: PropRef
radius: PropRef
output: string
}` | |
Example
...sim.grids.gridSim(springLatticeField({stiffness: p('stiffness'), damping: p('damping'), radius: p('radius'), output: 'displacement'}))
Tip. Add
uvRemapIdentityWhen: ({computeOutputs}) => !computeOutputs?.displacementso the warp is a no-op before the field exists.
See also
pointerSplatField— A field the cursor smears: cells near the pointer move with it, then fade back to rest.