withFrame

Evaluate a light part in a frame.

withFrame(frame: LightValue, part: LightPart, hint?: string): LightValue

Import light from shaders/std and use light.withFrame.

This is where a framed light starts: a frame, then the part (or modulate of several) drawn in it. Pass a name as the third argument when the part reads the frame more than once, so the frame is computed once per pixel. modulate always reads it more than once.

Parameters

NameTypeNotes
frameLightValue
partLightPart
hintstringOptional.

Example

coverage: withFrame(radialFrame(p('center')), modulate(softRayLobes({count: p('rayCount'), softness: p('softness'), spin: -1}), featherMask({radius: p('radius'), feather: p('feather')})), 'burstFrame')

Tip. Without the name, a modulate of two parts computes the frame twice.

See also

  • radialFrame — The frame for a burst, halo or sweep around a center prop.
  • beamFrame — The frame of a beam that starts at an anchor prop and points at the canvas center.
  • modulate — Multiply light parts drawn in the same frame, such as a mask over a pattern.

Used by

Godrays, SunBurst