wrapRamp
Runs a palette value back and forth cycles times so a ramp repeats without a seam.
wrapRamp(opts: {t: Expr; cycles: Expr | number}): Expr
Import paint from shaders/std and use paint.wrapRamp.
At cycles 1 the value passes through unchanged. Where the bands get thinner than a pixel they fade to the palette's middle instead of flickering. Use it on the value before the palette lookup, in a paint: function.
Parameters
| Name | Type | Notes |
|---|---|---|
opts | {t: Expr; cycles: Expr | number} |
Example
return standardPalette(wrapRamp({t: field, cycles: math.add(1, math.mul(uniformOf(p('wrapping'), params), 6))}), params)
Tip. Not for use inside a
guardedbranch. Reach forfoldRampthere.
See also
foldRamp— Folds any number into 0–1 as a seamless zigzag: up from 0 to 1, back down, every 2 units.scatterField— A mesh-gradient field: up to 8 drifting points scattered across the canvas, blended by nearness.