quadBlend

A four-color blend on a square: a to b across the top, c to d across the bottom, then top to bottom.

quadBlend(slots: {a: PropRef; b: PropRef; c: PropRef; d: PropRef; space: PropRef}): (t1: Expr, t2: Expr, params: GpuFragmentParams) => Expr

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

Returns a function you call with two 0–1 values (across, then down) and the params. Mixes in the color space named by the space prop (mark it compileTime). For any space other than linear, declare extraFields named convA, convB, convC, convD, each {schema: schema.vec3f, initial: [0, 0, 0]}.

Parameters

NameTypeNotes
slots{a: PropRef; b: PropRef; c: PropRef; d: PropRef; space: PropRef}

Example

const base = quadBlend({a: p('colorA'), b: p('colorB'), c: p('colorC'), d: p('colorD'), space: p('colorSpace')})(t1, t2, params)

See also

  • colorLadder3 — A three-color blend: a to b by the first value, then on to c by the second.
  • pair — A palette of two color props, mixed in the color space named by the space prop.

Used by

FlowingGradient