p5((s) => {
let w = 23.4*30;
let h = 33.1*30;
let cw = 2;
let ch = 2;
s.setup = function () {
s.createCanvas(w, h);
s.frameRate(1);
};
s.draw = function () {
s.background(0)
for (let x = 0-cw; x < w; x += cw) {
for (let y = 0-ch; y < h; y += ch) {
s.translate(x, y)
s.translate(cw / 2, ch / 2)
s.stroke(s.random(0,255),0,0)
s.strokeWeight(cw/4)
s.line(cw, ch/2, cw, ch)
s.stroke(0,s.random(0,255),0)
s.line(cw*25/20, ch/2, cw*25/20, ch)
s.stroke(0,0,s.random(0,255))
s.line(cw*15/20, ch/2, cw*15/20, ch)
s.resetMatrix()
}
}
};
s.keyPressed = function ({key}) {
if (key === 's') {
s.pixelDensity(10)
s.draw()
s.saveCanvas('image', 'png')
s.pixelDensity(s.displayDensity())
}
};
})