Field class
A displacement field over the box: `size` × `size` cells, each a vector in box px (y up) that the pointer pushes along its path.
import { Field } from '@dioramajs/media/liquid'. Every step it decays, spreads to the neighbours and drifts along itself. Deterministic: the same strokes and steps give the same field.
class FieldMembers
| Name | Type | Description |
|---|---|---|
constructor | | |
peak | number | Largest displacement in the field, px. Default |
readonly size | number | |
readonly x | Float32Array | |
readonly y | Float32Array | |
clear | | |
step | | One step of |
stroke | | Pushes the cells within |
write | | Packs the field into half floats, four per cell: the displacement in px, then the slope of its length (px per px), which the water style reads as the slope of a surface. |
Defined in packages/media/src/liquid.ts.