xxxxxxxxxx
89
var tileCount = 4;
var actRandomSeed = 0;
function setup() {
createCanvas(800, 800);
}
function draw() {
clear();
background("#EDE9E0");
randomSeed(actRandomSeed);
for (var gridY = 0; gridY < tileCount; gridY++) {
for (var gridX = 0; gridX < tileCount; gridX++) {
let shades = ["#91382C", "#27282D", "#D6837F", "#D7C585","#5A756F", "#8F7925"];
let shade = random(shades);
cS = color(shade);
fill(cS);
stroke(cS);
strokeWeight(4);
var posX = width / tileCount * gridX;
var posY = height / tileCount * gridY;
var s = int(random(0, 5));
if (s == 0) {
for (x=posX+9; x<posX + width / tileCount; x=x+18){
for (y=posY+9; y<posY + height / tileCount; y=y+18){
noStroke();
ellipse(x, y, 10);
}
}
}
if (s == 1) {
noStroke();
triangle(posX + width / tileCount, posY, posX + width / tileCount, posY + height / tileCount, posX, posY + height / tileCount);
let shade = random(shades);
cS = color(shade);
fill(cS);
triangle(posX, posY + height / tileCount, posX, posY, posX + width / tileCount, posY);
}
if (s == 2) {
for (y=posY+5; y<posY + height / tileCount; y=y+10){
line(posX, y, posX + width / tileCount,y);
}
}
if (s == 3) {
for (x=posX+5; x<posX + width / tileCount; x=x+10){
line(x, posY, x,posY + height / tileCount);
}
}
if (s == 4) {
noStroke();
rect(posX, posY, posX + width / tileCount, (posY + height / tileCount)/2);
let shade1 = random(shades);
cS1 = color(shade1);
fill(cS1);
rect(posX, (posY + height / tileCount)/2, (posX + width / tileCount)/4, posY + height / tileCount/2);
let shade2 = random(shades);
cS2 = color(shade2);
fill(cS2);
rect((posX + width / tileCount)/2, (posY + height / tileCount)/2, (posX + width / tileCount)/4, posY + height / tileCount/2);
}
}
}
}
function mouseReleased() {
actRandomSeed = random(100000);
}