xxxxxxxxxx
let c = 50;
function setup() {
createCanvas(500, 500)
background(240)
noFill()
for (let i = 0; i < width; i += c)
for (let j = 0; j < height; j += c) {
figura(i, j, c, floor(random(9)))
}
}
function figura(x, y, s, f) {
if (f == 1) {
arc(x, y + s, 2 * s, 2 * s, 3 * PI / 2, TWO_PI)
} else if (f == 2) {
arc(x, y, 2 * s, 2 * s, 0, PI / 2)
} else if (f == 3) {
arc(x + s, y, 2 * s, 2 * s, PI / 2, PI)
} else if (f == 4) {
arc(x + s, y + s, 2 * s, 2 * s, PI, 3 * PI / 2)
} else if (f == 5) {
arc(x, y + s / 2, sqrt(2) * s, sqrt(2) * s, -PI / 4, PI / 4)
} else if (f == 6) {
arc(x + s / 2, y, sqrt(2) * s, sqrt(2) * s, PI / 4, 3 * PI / 4)
} else if (f == 7) {
arc(x + s, y + s / 2, sqrt(2) * s, sqrt(2) * s, 3 * PI / 4, 5 * PI / 4)
} else if (f == 8) {
arc(x + s / 2, y + s, sqrt(2) * s, sqrt(2) * s, 5 * PI / 4, 7 * PI / 4)
}
}