rings

Repeats a field as concentric bands.

rings(field: Field, count: FieldScalar): Field

Import paint from shaders/std and use paint.rings.

count above 1 restarts the field every 1/count, so a radial gradient becomes rings. At 1 or below the field is clamped to 0–1, and values under 1 stretch the gradient further out.

Parameters

NameTypeNotes
fieldField
countFieldScalar

Example

paint: rampOver(rings(dist.radial({center: p('center'), radius: p('radius'), aspect: 1, skew: 0}), p('repeat')), stops(p('colorSpace')))

Tip. Each band restarts at the first color rather than bouncing back. For a mirrored repeat, pass edges to rampOver instead.

See also

  • tiles — Repeats a field count times, always wrapping.
  • rampOver — A paint that colors each pixel by looking its field value up in a palette.

Used by

DiamondGradient, RadialGradient