xxxxxxxxxx
let x = 0;
let y = 0;
let r;
let g;
let b;
function setup() {
createCanvas(640, 400);
objectWidth = width * 0.1;
objectHeight = height * 0.1;
angleMode(DEGREES);
r = random(255);
g = random(255);
b = random(255);
background(r, g, b);
}
// background(220);
function draw() {
for (i = 0; i < 1; i++) {
if (random(1) > 0.5) {
fill(random(255), random(255), random(255));
square(x, y, objectWidth);
x += objectWidth;
}
if (random(1) <= 0.5) {
square(x, y, objectWidth * 2)
x = x + objectWidth * 2
if (x > width) {
x = 0;
y += objectHeight;
if (y > height) {
noLoop();
}
}
}
}
}
// console.log(y);