lightBeam

The glow of a beam that can be thicker or softer at one end than the other.

lightBeam(
  dist: Expr,
  t: Expr,
  thickness: {start: Expr; end: Expr},
  softness: {start: Expr; end: Expr},
): Expr

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

Give it the distance from the line and the position along it from segmentProject. Thickness and softness blend from start to end along the beam, in the distance unit. Returns vec2(colorT, alpha): alpha is 1 inside the beam and fades to 0 outside, and colorT runs 0 at the core to 1 at the edge so you can shade the two differently.

Parameters

NameTypeNotes
distExpr
tExpr
thickness{start: Expr; end: Expr}
softness{start: Expr; end: Expr}

Example

const beam = lightBeam(seg.member('y'), seg.member('x'), {start: p('startThickness'), end: p('endThickness')}, {start: p('startSoftness'), end: p('endSoftness')})

See also

  • segmentProject — Where a pixel falls along a line from a to b, and how far it is from that line.