let colors = ["#ed3441", "#ffd630", "#329fe3", "#154296", "#303030", '#f0f0f0', "#213647", "#2ec4b6", "#c4071d", "#ff9f1c", "#247ba0"];
createCanvas(1080, 1080);
rect(50, 50, width-100, height-100, 3);
divideRect(120, 120, width - 240, height - 240, 100);
function divideRect(x, y, w, h) {
let rnd = int(random(2));
let w1 = int(random(1, cc)) * (w / cc);
let h1 = int(random(1, cc)) * (h / cc);
if ((w1 > min) && (w2 > min) && (h1 > min) && (h2 > min)) {
divideRect(x + w1, y, w2, h);
divideRect(x, y + h1, w, h2);
let rnd = int(random(5) + 1);
rect(x+1, y+1, w-2, h-2);
rect(x + off, y + off, w - off * 2, h - off * 2);
grid(x + off, y + off, w - off * 2, h - off * 2);
checkered(x + off, y + off, w - off * 2, h - off * 2);
masu(x + off, y + off, w - off * 2, h - off * 2);
ccr(x + off, y + off, w - off * 2, h - off * 2);
function grid(x_, y_, w_, h_) {
let c1 = int((w_ + h_) / random(5, 20));
let c2 = floor((c1 * h_) / w_);
c1 = floor((c2 * w_) / h_);
for (let i = 0; i < c1; i++) {
for (let j = 0; j < c2; j++) {
rect(x, y, w + 1, h + 1);
function checkered(x, y, w, h) {
let c1 = int((w + h) / random(15, 30));
let c2 = floor((c1 * h) / w);
c1 = floor((c2 * w) / h);
for (let i = 0; i < c1; i++) {
for (let j = 0; j < c2; j++) {
if ((i + j) % 2 == 0) rect(posX, posY, dw, dh);
function masu(x, y, w, h) {
if (random() < 0.5) vertex(x + w, y + h);
function ccr(x, y, w, h){
let d = (w < h ? w : h) * random(0.5, 0.9);
let xx = x + (random(-0.5, 0.5) * (w - (d))) + w / 2;
let yy = y + (random(-0.5, 0.5) * (h - (d))) + h / 2;