gatherStack

Assemble an effect from one sampling stage and an ordered list of overlay stages.

gatherStack(
  sample: SampleStage,
  overlays: OverlayStage[],
  opts?: {resultAlpha?: 'premultiplied' | 'straight'},
): GatherEffect

Import effects from shaders/std and use effects.blurs.gatherStack.

The child renders to a texture, the sampling stage reads it, and each overlay edits the result in turn. Put the result in a filter's effect: field. Pass {resultAlpha: 'straight'} only when the stack already returns straight (not premultiplied) alpha, as crispTap and refractedTaps do.

Parameters

NameTypeNotes
sampleSampleStage
overlaysOverlayStage[]
opts{resultAlpha?: 'premultiplied' | 'straight'}Optional.

Example

effect: gatherStack(rgbSplit({amount: p('colorShift')}), [scanlines({frequency: p('lines'), intensity: 0.3}), opaque()])

Tip. An empty overlay list is fine: gatherStack(stage, []) wraps a lone sampling stage.

See also

  • SampleStage
  • OverlayStage
  • GatherFrame

Used by

CRTScreen, ChromaticAberration, DropShadow, FlutedGlass, Glitch, PagePeel, Sparkle, Spherize, VHS