xxxxxxxxxx
// By Roni Kaufman
// https://ronikaufman.github.io/
function setup() {
createCanvas(500, 500);
noFill();
noLoop();
strokeCap(PROJECT);
}
function draw() {
background(0);
translate(width/2, height/2);
let palette = [[253, 55, 65], [254, 79, 17], [255, 104, 0], [255, 166, 26], [255, 194, 25], [255, 209, 20], [252, 216, 46], [244, 215, 48], [206, 213, 98], [138, 195, 143], [121, 183, 160], [114, 181, 177], [91, 155, 174], [107, 161, 183], [73, 97, 157], [96, 71, 145], [114, 30, 127], [155, 43, 119], [171, 37, 98], [202, 40, 71]];
let colors = [];
let n_colors = floor(random(3, 9));
for (let i = 0; i < n_colors; i++) {
let col = floor(random(random(palette.length)));
colors.push(palette.splice(col, 1)[0]);
}
let thetaStep = TWO_PI/24;
let d = 104;
for (let i = 0; i < 9; i++) {
let delta = pow(i+7, 2.5)/5;
strokeWeight(delta/10);
for (let theta = 0; theta < TWO_PI; theta += thetaStep) {
stroke(random(colors));
let d1 = d + delta/4;
let d2 = d + 3*delta/4;
let theta1 = theta+thetaStep/4;
let theta2 = theta+3*thetaStep/4;
arc(0, 0, d1, d1, theta1, theta2);
arc(0, 0, d2, d2, theta1, theta2);
line(d1/2*cos(theta1), d1/2*sin(theta1), d2/2*cos(theta1), d2/2*sin(theta1));
line(d1/2*cos(theta2), d1/2*sin(theta2), d2/2*cos(theta2), d2/2*sin(theta2));
}
d += delta;
}
}
function keyPressed() {
if (key === " ") {
redraw();
}
}