xxxxxxxxxx
35
let x = 0;
let y = 0;
let size = 20;
let size2 = size * 2;
let sizeD2 = size / 2;
let size1_5 = size * 1.5;
function setup() {
createCanvas(400, 400);
background(40, 12, 20);
strokeWeight(2);
}
function draw() {
let r = random();
stroke(r * 255, 0, 255 - r * 125);
if (r < 0.5) {
line(x, y, x + size, y + sizeD2);
line(x, y + size, x + size, y + sizeD2);
line(x + size, y + size1_5, x + size, y + sizeD2);
} else {
line(x, y + sizeD2, x + size, y);
line(x, y + sizeD2, x + size, y + size);
line(x + size, y + size1_5, x + size, y + sizeD2);
line(x, y + size1_5, x, y + sizeD2);
}
x += size;
if (x > width) {
x = 0;
y += size1_5;
if (y > height)
noLoop();
}
}