xxxxxxxxxx
39
function setup() {
createCanvas(windowWidth, windowHeight);
frameRate(30)
colorMode(HSB, 1, 1, 1, 1);
strokeWeight(4)
anim_frames = 60z
angle = 0
angle_delta = TAU / anim_frames
}
function draw() {
translate(width / 2, height / 2);
rotate(angle);
background(0);
drawSpiral(200, 5.5)
drawSpiral(200, 5.25)
drawSpiral(200, 5)
drawSpiral(200, 4.75)
drawSpiral(200, 4.5)
angle += angle_delta
}
function drawSpiral(num_points, num_rotations) {
prev_x = 0;
prev_y = 0;
for (let i = 0; i < num_points; i++) {
a = map(i, 0, num_points, 0, TAU * num_rotations);
r = map(i, 0, num_points, 1, min(width, height) * 0.75);
x = r * cos(a);
y = r * sin(a);
stroke(i / num_points, 1, 1)
line(prev_x, prev_y, x, y);
prev_x = x;
prev_y = y;
}
}