direction

A direction in degrees as a unit vector.

direction(angleDeg: Expr | number, hint: string = 'dir'): Expr

Import frames from shaders/std and use frames.direction.

0° points right and angles turn clockwise on screen, so 90° points down. Use it wherever a word wants a light or flow direction as a vector.

Parameters

NameTypeNotes
angleDegExpr | number
hintstringOptional. Default 'dir'.

Example

const light = direction(params.uniforms.lightAngle, 'light')

See also

  • directionFrame — The two axes of a direction given in degrees, for patterns that run along it.

Used by

BrushedMetal, CarbonFiber, Frost, Goo, LiquidMetal, Nebula, Obsidian, Plastic, Water