xxxxxxxxxx
// 01.01.25
//
// Made for Genuary 2025
// #genuary #genuary1
// Vertical or horizontal lines only.
//
// https://www.instagram.com/lucjastozek/
let side, margin, smallRect;
const palette = [
'#D64933',
'#FA8334',
'#EA9010',
'#2D854A',
'#14591D',
'#3587A4',
'#23B5D3',
'#70587C',
'#573280',
'#832232',
'#DA4167',
'#E87461'
];
function setup() {
createCanvas(windowWidth, windowHeight);
frameRate(3);
noFill();
stroke("#050505");
side = min(width, height) * 0.8;
margin = {
x: (width - side) / 2,
y: (height - side) / 2,
}
smallRect = {
side: side / 14.5,
margin: side / 29
}
}
function drawRegularLines(x, y) {
const lineNum = 5;
const weight = smallRect.margin * 0.12
const gap = (smallRect.side - weight * lineNum) / (lineNum - 1);
strokeWeight(weight);
for (let i = 1; i <= lineNum; i++) {
const lineX = x + gap * i;
line(lineX, y, lineX, y + smallRect.side);
}
square(x, y, smallRect.side)
}
function drawAcrossLines(x, y) {
const lineNum = 5;
const weight = smallRect.margin * 0.12
const gap = (smallRect.side - weight * lineNum) / (lineNum + 1);
strokeWeight(weight);
for (let i = 1; i <= lineNum; i++) {
stroke(random(palette));
const lineY = y + gap * i;
line(x, lineY, x + smallRect.side, lineY);
}
stroke("#050505");
square(x, y, smallRect.side)
}
function draw() {
background("#fffbe6");
let x = margin.x;
let y = margin.y;
for (let column = 0; column < 10; column++) {
const across = floor(random(0, 10));
for (let row = 0; row < 10; row++) {
if (row === across) {
drawAcrossLines(x, y);
} else {
drawRegularLines(x, y);
}
y += smallRect.side + smallRect.margin;
}
y = margin.y;
x += smallRect.side + smallRect.margin;
}
}