layers

Stacks colors into one, first entry at the back.

layers(entries: Layer[]): Expr

Import compose from shaders/std and use compose.layers.

Each entry is a color, or {paint, blend, opacity, behind} (see Layer). Entries add together unless one asks for 'screen'. Needs at least one entry.

Parameters

NameTypeNotes
entriesLayer[]

Example

const rgb = layers([
  {paint: sky, opacity: 0.6},
  {paint: stars, behind: fog.transmittance},
  {paint: glow, blend: 'screen'},
])

See also

  • layered — Builds N variations of one thing from a data list and sums them with weights.
  • emissiveAlpha — Turns an rgb light value into a color with alpha, so glows composite over transparency.

Used by

Nebula