cellDistances
Distances from each pixel to its nearest two cell points, as (d1, d2): the raw material for Voronoi fills and borders.
cellDistances(slots: {scale: PropRef; seed: PropRef}): Field
Import noise from shaders/std and use noise.cellDistances.
scale is the number of cells across and seed picks a different set of points. The points drift on the layer's clock. Feed it to cellFill or cellBorders, and wrap it in share when both read it.
Parameters
| Name | Type | Notes |
|---|---|---|
slots | {scale: PropRef; seed: PropRef} |
Example
const cells = share(cellDistances({scale: p('scale'), seed: p('seed')}))
See also
cellFill— A 0–1 fill for each cell: 0 at the cell's point, 1 at its boundary, whatever the cell size.cellBorders— A mask of the lines between cells: 0 on a boundary, 1 inside a cell.share— Evaluates a field once and lets several words read the same result.