xxxxxxxxxx
45
let max = [];
function setup() {
createCanvas(400, 400);
for (let i = 0; i < 10; i++) {
max[i] = new Max();
}
}
function draw() {
background(20, 50, 75);
for (let i = 0; i < 10; i++) {
max[i].display();
}
class Max {
constructor(x, y, size) {
this.x = 100;
this.y = 100;
this.size = 100;
this.color = color (random (255), random (255), random (255));
}
display() {
fill (this.color);
noStroke();
rect (this.x, this.y, this.size, this.size);
}
}
}