function setup() {
createCanvas(windowWidth, windowHeight);
pixelDensity(2);
frameRate(1);
}
let ColorPattern = [
['#493548','#FFC145','#FF6B6C','#5B5F97','#4B4E6D'],
['#FFC145','#FF6B6C','#5B5F97','#4B4E6D','#493548'],
['#FF6B6C','#5B5F97','#4B4E6D','#493548','#FFC145'],
['#5B5F97','#4B4E6D','#493548','#FFC145','#FF6B6C'],
['#4B4E6D','#493548','#FFC145','#FF6B6C','#5B5F97']
];
let g = 7;
function grid(){
let w = width / g;
let h = height / g;
for (let i = 1; i <= g - 1; i++) {
stroke(150);
strokeWeight(1);
line(w * i, 0, w * i, height);
line(0, h * i, width, h * i);
}
for (let i = 0; i < g; i++) {
let col = int(random(g));
let row = int(random(g));
fill(200);
rect(col * w, row * h, w, h);
}
}
function grain() {
for (let i = 0; i < 100000; i++) {
fill(255, 30);
circle(random(width), random(height), 2);
}
}
function draw() {
resizeCanvas(windowWidth, windowHeight);
let l = ColorPattern.length;
let p = int(random(l));
colorP = ColorPattern[p];
let ll = colorP.length;
bgColor = colorP[0];
background(bgColor);
grid();
for (let i = 0; i < 85; i++) {
if (i < 15 || i % 2 == 0){
continue;
}
let Cd = colorP[int(random(ll))];
while (Cd == bgColor) {
Cd = colorP[int(random(ll))];
}
r = i * 2;
noStroke();
fill(Cd);
x = random(width);
y = random(height);
ellipse(x, y, r);
fill(bgColor);
x_diff = x + random(-5,5);
y_diff = y + random(-5,5);
ellipse(x_diff, y_diff, r*0.6);
}
for(let i = 0; i < 20000; i++) {
ellipse(random(width), random(height), random(0.75));
}
}
function mousePressed() {
redraw();
}