crispFill

A clean fill of a shape: 1 inside, 0 outside.

crispFill(opts: {distance: Expr; footprint: Expr | number}): Expr

Import mask from shaders/std and use mask.crispFill.

distance is a signed distance, negative inside the shape, such as one from the shape words. footprint is how wide the edge blends. One pixel in the distance's units gives an anti-aliased edge. A wider value gives a deliberate soft edge.

Parameters

NameTypeNotes
opts{distance: Expr; footprint: Expr | number}

Example

const bar = mask.crispFill({distance: shape.roundedRect(x, y, w, h, rounding), footprint: px})

Tip. One pixel in uv is div(1, viewport.member('y')), with viewport from frames.surfaceOf.

See also

  • crispStroke — A clean outline of a shape, or a drawn curve, of a given width.
  • softDisc — A filled disc with a soft, shaped edge.

Used by

Waveform