xxxxxxxxxx
// By Roni Kaufman
// https://ronikaufman.github.io/
let n;
let s;
let tile;
// palette from Chromotome (https://kgolid.github.io/chromotome-site/)
let palette = ["#eb5627", "#eebb20", "#4e9eb8", "#f7f5d0"];
function setup() {
createCanvas(600, 600);
imageMode(CENTER);
noLoop();
n = random([4, 5, 3, 5]);
//shuffle(palette, true);
let colors = [palette[2],
palette[3],
palette[2],
palette[1],
palette[0],
palette[1],
palette[2]];
s = width/n;
tile = createGraphics(s, s);
tile.background(colors[1]);
tile.stroke("#201d13");
tile.strokeWeight(2);
let m = colors.length;
let r = s/m;
for (let i = m-1; i > 0; i--) {
tile.fill(colors[i])
tile.circle(0, 0, i*r*2);
}
for (let i = m-1; i > 0; i--) {
tile.fill(colors[i])
tile.circle(s, s, i*r*2);
}
}
function draw() {
for (let x = s/2; x < width; x += s) {
for (let y = s/2; y < height; y += s) {
push();
translate(x, y);
rotate(random([0, PI/2, PI, -PI/2]))
image(tile, 0, 0);
pop();
}
}
}