atan2

The angle of the point (x, y) in radians, −π..π.

atan2(y: Val, x: Val): Expr

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

Takes y first. Turns an offset from a center into an angle around it.

Parameters

NameTypeNotes
yVal
xVal

Example

const angle = atan2(delta.member('y'), delta.member('x'))

See also

  • sin — The sine of an angle in radians, −1..1.
  • cos — The cosine of an angle in radians, −1..1.