foldRamp
Folds any number into 0–1 as a seamless zigzag: up from 0 to 1, back down, every 2 units.
foldRamp(t: Expr): Expr
Import paint from shaders/std and use paint.foldRamp.
Scale the value first to set the cycle length. Safe anywhere, including inside a guarded branch.
Parameters
| Name | Type | Notes |
|---|---|---|
t | Expr |
Example
const rgb = stops(p('colorSpace'))(foldRamp(phase), params).member('rgb')
See also
wrapRamp— Runs a palette value back and forthcyclestimes so a ramp repeats without a seam.