xxxxxxxxxx
37
let rectSize = 30;
function setup() {
createCanvas(400, 400);
frameRate(1.5);
}
function draw() {
background(50);
noStroke();
// for loop to draw horizontal lines
for (let y = 0; y < height; y += rectSize) {
fill(random(255), random(255), random(255));
rect(0, y, width, rectSize);
}
// for loop to draw vertical lines
// for (variable/init, condition/width limit, what it does each loop)
for (let x = 0; x < width; x += rectSize) {
fill(random(255), random(255), random(255));
rect(x, 0, rectSize, height);
}
// // nested for loop for weave pattern
// for (let y = 0; y < height; y += rectSize) {
// for (let x = 0; x < width; x += rectSize) {
// fill(random(255), random(255), random(255), random(0,255));
// ellipse(x,y,rectSize,rectSize);
// //rect(x,y,rectSize,rectSize);
// }
// }
noLoop();
}