sampleMapsAtCellCentres
Makes map-driven props change per whole cell instead of per pixel, so a mapped dot size or line thickness grows cell by cell rather than being cut off mid-cell.
sampleMapsAtCellCentres(slots: {
cells: PropRef
rotation?: PropRef
props: string[]
}): GpuMapSampleUVs
Import patterns from shaders/std and use patterns.sampleMapsAtCellCentres.
Set it on the definition's mapSampleUVs field, not in paint:. Give it the same cells count and rotation (degrees) the pattern uses so the snapping matches the lattice. props lists the prop names to snap.
Parameters
| Name | Type | Notes |
|---|---|---|
slots | `{ |
cells: PropRef
rotation?: PropRef
props: string[]
}` | |
Example
mapSampleUVs: sampleMapsAtCellCentres({cells: p('cells'), rotation: p('rotation'), props: ['thickness', 'softness']})
Tip. Only matters when a prop is driven by a map (an image or another layer). Plain values are unaffected.
See also
cellFrame— The shared coordinate system of a tiled pattern: how many cells fit down the canvas height and how far the whole lattice is rotated.dotLattice— A mask of round dots on a square grid, with optional row stagger, drift and twinkle.gridLines— Square grid lines drawn in acellFrame, plus a per-cell shade for the fill.