xxxxxxxxxx
35
let x = 5;
let y = 5;
function setup () {
createCanvas (windowWidth, windowHeight);
rectMode(CENTER);
fill(0);
noStroke();
}
function draw () {
let nb = width/10 * height/10;
let t = map(frameCount,0,nb,0,1);
if (random() > t) {
fill('#36ed95');
}
else {
fill('#eaeaea');
}
rect (x,y,10,10);
x= x + 10;
t = t + 0.001;
if (x >= width){
x = 5;
y = y + 10;
}
if(frameCount > nb){
noLoop();
}
}