xxxxxxxxxx
43
/**************************************************************
Inspiré par
https://twitter.com/mathladyhazel/status/1453552799745183744
**************************************************************/
let lineLength, yOffset ;
let squareHeight = 50 ;
let xOffset = 10 ;
function setup() {
createCanvas(windowWidth, windowHeight);
fill( 0 ) ;
stroke( 180 ) ;
strokeWeight( 4 ) ;
background(250);
lineLength = width ;
yOffset = squareHeight ;
let compteur = 0 ;
let Xoff ;
for (t = 0 ; t <= height ; t+= yOffset) {
line( 0, t, lineLength, t ) ;
Xoff = xOffset * (compteur+1) ;
if (compteur % 3 === 0) {
Xoff = xOffset ;
compteur = 0 ;
}
for (j = 0 ; j <= (width - squareHeight) ; j+= 2 * squareHeight) {
rect( j + Xoff, t, squareHeight, squareHeight ) ;
}
compteur++ ;
}
}