xxxxxxxxxx
let colors = [];
let rectWidth;
let rectHeight;
let numCols = 10;
let numRows = 6;
let flicker = 0.005;
function setup() {
createCanvas(windowWidth, windowHeight);
rectWidth = width / numCols;
rectHeight = height / numRows;
noStroke();
generateColors();
}
function draw() {
for (let i = 0; i < numCols; i++) {
for (let j = 0; j < numRows; j++) {
let colIndex = i * numRows + j;
let r = red(colors[colIndex]);
let g = green(colors[colIndex]);
let b = blue(colors[colIndex]);
r = (r + random(-flicker, flicker) * 255) % 255;
g = (g + random(-flicker, flicker) * 255) % 255;
b = (b + random(-flicker, flicker) * 255) % 255;
colors[colIndex] = color(r, g, b);
fill(colors[colIndex]);
rect(i * rectWidth, j * rectHeight, rectWidth, rectHeight);
}
}
textAlign(CENTER, CENTER);
textSize(48);
fill(255);
text("ART BASE", width / 2, height / 2);
}
function generateColors() {
for (let i = 0; i < numCols * numRows; i++) {
colors.push(color(random(255), random(255), random(255)));
}
}