strokeOver

Two colors mixed through a mask: fill where the mask is 0, stroke where it is 1.

strokeOver(layers: {fill: PaintSlot; stroke: PaintSlot; mask: PaintSlot; space?: PropRef}): PatternPaint

Import patterns from shaders/std and use patterns.strokeOver.

The everyday way to color a pattern. space is a color-space prop ('linear', 'oklch', 'oklab', 'hsl', 'hsv', 'lch'); leave it out for a linear mix. Alpha interpolates too, so a transparent fill gives a lines-only pattern.

Parameters

NameTypeNotes
layers{fill: PaintSlot; stroke: PaintSlot; mask: PaintSlot; space?: PropRef}

Example

paint: strokeOver({fill: p('colorA'), stroke: p('colorB'), mask: checkerCells({cells: p('cells'), softness: p('softness')}), space: p('colorSpace')})

Tip. The space prop must be compileTime: true. Changing it recompiles the shader.

See also

  • withAlpha — A color with its alpha replaced by a separately built mask.
  • mixOf — A straight blend from one value to another by an amount from 0 to 1.
  • vary — A color lightened or darkened per cell by a shade factor, alpha untouched.

Used by

BrickPattern, Checkerboard, Chevron, FallingLines, Grid, HexGrid, IsometricCubes, Ripples, Stripes, TriangularGrid, Truchet