directionFrame

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

directionFrame(angleDeg: Expr | number, hint: string = 'grain'): DirectionFrame

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

tangent points along the direction, perp at right angles to it. coordsOf(point) returns that point's along and across distances in the frame. Brush grain, weave, streaks and flow all live in one of these.

Parameters

NameTypeNotes
angleDegExpr | number
hintstringOptional. Default 'grain'.

Example

const grain = directionFrame(params.uniforms.brushAngle, 'brush'); const {along, across} = grain.coordsOf(delta)

See also

  • direction — A direction in degrees as a unit vector.
  • segmentFrame — A frame along the line between two position props: how far each pixel is along it and across it.

Used by

BrushedMetal, CarbonFiber, Heatmap, Obsidian