xxxxxxxxxx
let s;
function setup() {
createCanvas(600, 600);
angleMode(DEGREES);
colorMode(HSB, 360, 100, 100);
s = random(360)
noLoop();
}
function draw() {
background(255);
recCircle(width / 2, height / 2, 200, 6);
}
function recCircle(x, y, r, n) {
strokeWeight(1)
//stroke(n * 50, 100, 0);
noFill();
push();
let g = random(r)
translate(x, y);
beginShape();
for(let i = 0; i < 360; i += 60) {
let vx = r * cos(s + i);
let vy = r * sin(s + i);
vertex(vx, vy);
}
endShape(CLOSE);
pop();
n--;
if(n > 0){
let d1 = random(360);
let d2 = random(360);
let d3 = random(360);
let d4 = random(360);
recCircle(x + r * cos(d1), y + r * sin(d1), r / 3, n);
recCircle(x + r * cos(d2), y + r * sin(d2), r * 2 / 3, n);
recCircle(x + r * cos(d3), y + r * sin(d3), r / 4, n);
recCircle(x + r * cos(d4), y + r * sin(d4), r / 2, n);
}
}