xxxxxxxxxx
29
function setup() {
createCanvas(800, 500);
background(220);
noLoop();
}
function draw() {
stroke(0, 200);
fill(0, 255, 255, 50);
draxJewel(200, 50, 400);
}
function draxJewel(x, y, s) {
if (s > 20) {
rect(x, y, s, s);
let r = int(random(2));
if (r == 0) {
draxJewel(x, y, s / 2);
draxJewel(x + s/2, y + s/2, s / 2);
}
else if (r == 1) {
draxJewel(x + s / 2, y, s / 2);
draxJewel(x, y + s/2, s / 2);
}
}
}