rotate2

A 2D point rotated around the origin.

rotate2(p: Val, cosA: Val, sinA: Val): Expr

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

Pass the cosine and sine of the angle in radians, computed once, and the same pair rotates every point.

Parameters

NameTypeNotes
pVal
cosAVal
sinAVal

Example

const spun = local(rotate2(delta, cos(angle), sin(angle)), 'spun')

See also

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

Used by

FlowingGradient, MeshGradient