const tileWidth = width / colCount;
const tileHeight = height / rowCount;
createCanvas(width, height);
colorMode(HSB, 360, 100, 100);
const baseHue = (frameCount * 5) % 360;
for (let row = 0; row < rowCount; row++) {
for (let col = 0; col < colCount; col++) {
const x = col * tileWidth;
const y = row * tileHeight;
const hue = (baseHue + row * 20 + col * 20) % 360;
stroke(hue, saturation, brightness);
drawTile(x, y, tileWidth, tileHeight);
function drawTile(x, y, width, height) {
const patternType = int(random(3));
const divisions = int(random(3, 6));
for (let i = 0; i < divisions; i++) {
const yPos = (i / divisions) * height;
line(0, yPos, width, yPos);
} else if (patternType === 1) {
for (let i = 0; i < divisions; i++) {
const xPos = (i / divisions) * width;
line(xPos, 0, xPos, height);
for (let i = 0; i < divisions; i++) {
const xPos = (i / divisions) * width;
const yPos = (i / divisions) * height;
line(0, yPos, xPos, height);
line(xPos, 0, width, yPos);
if (millis() - lapse > 400){
save("img_" + month() + '-' + day() + '_' + hour() + '-' + minute() + '-' + second() +