xxxxxxxxxx
114
var tileCount = 4;
var actRandomSeed = 0;
function setup() {
createCanvas(800, 800);
}
function draw() {
clear();
background("#ffffff");
randomSeed(actRandomSeed);
for (var gridY = 0; gridY < tileCount; gridY++) {
for (var gridX = 0; gridX < tileCount; gridX++) {
let shades = ["#ce9124", "#ffa4be", "#a7132b", "#6a859e", "#71935c", "#1e1108" ];
let shade = random(shades);
cS = color(shade);
fill(cS);
stroke(cS);
strokeWeight(2);
var posX = width / tileCount * gridX;
var posY = height / tileCount * gridY;
var s = int(random(0, 7));
if (s == 0) {
for (x=posX+4; x<posX + width / tileCount; x=x+9){
for (y=posY+4; y<posY + height / tileCount; y=y+9){
noStroke();
ellipse(x, y, 5);
}
}
}
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+2; y<posY + height / tileCount; y=y+5){
line(posX, y, posX + width / tileCount,y);
}
}
if (s == 3) {
for (x=posX+2; x<posX + width / tileCount; x=x+5){
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);
}
if (s == 6) {
noStroke();
for (y = posY; y < posY + height / tileCount; y = y + ((posY + height / tileCount) / tileCount)) {
for (x = posX; x < posX + width / tileCount; x = x + ((posX + height / tileCount) / tileCount)) {
let shade1 = random(shades);
cS1 = color(shade1);
fill(cS1);
rect(x, y, posX + width / tileCount, (posY + height / tileCount) / tileCount);
}
}
}
if (s == 5) {
noStroke();
triangle(posX, posY, posX + width / tileCount, posY, posX + width/ tileCount, posY + height / tileCount);
let shade = random(shades);
cS = color(shade);
fill(cS);
triangle(posX, posY, posX + width / tileCount, posY + height / tileCount, posX, posY + height / tileCount);
}
}
}
}
function mouseReleased() {
actRandomSeed = random(100000);
}