The concept
Polar coordinates (r, θ) describe a point by distance from center and angle. Conversion to Cartesian: x = r*cos(θ), y = r*sin(θ). Varying θ from 0 to TWO_PI while changing r traces spirals. This is the foundation of all circular geometry in creative coding.
The code
// Polar spiral
function setup() { createCanvas(400, 280); }
function draw() {
background(11, 15, 20);
translate(width/2, height/2);
stroke(55, 227, 195); noFill(); strokeWeight(1.5);
beginShape();
for (let a = 0; a < TWO_PI * 5; a += 0.02) {
let r = a * 12 + sin(a * 3 + frameCount * 0.02) * 8;
vertex(cos(a) * r * 0.15, sin(a) * r * 0.15);
}
endShape();
}Going further
Explore other free courses on the Learn page, or book a call to discuss your project.
Want to go further?
Book a discovery call →