abs

The value without its sign.

abs(x: Val): Expr

Import math from shaders/std and use math.abs.

Turns a signed distance into a distance from the line, so a stroke covers both sides.

Parameters

NameTypeNotes
xVal

Example

const fromLine = abs(sub(uv.member('y'), 0.5))

See also

  • sign — −1, 0 or 1 by the sign of the value.
  • neg — The value with its sign flipped.

Used by

CarbonFiber, Chrome, Crystal, FlowingGradient, Heatmap, Hologram, Nebula, Plastic, Water, Waveform