02 Drawing shapes with math
Polar coordinates: distance and angle
length gives the distance, atan the angle. Petals and spirals come from these two.
112
00.15
-88
ExerciseTune values
Make a three-petal flower
Runs once per pixelDrag numbers, or edit the code
JS side
gl.uniform2f(uResolution, …, …)length gives distance, atan gives angle: in polar coordinates petals, rays and spirals are one line each.
Try it
- Set the petals to 3
- Add a little twist to get a spiral
- Find the line where the colour jumps: atan breaks at ±π