xxxxxxxxxx
31
//array of 20 dots - use four loops to iterate through the dots & display them
//array
let dots = [];
function setup() {
createCanvas(400, 400);
for (let i = 0; i < 20; i++) {
dots[i] = new Dot();
}
}
function draw() {
background(220);
for (let i = 0; i < 20; i++) {
dots = [i].show();
}
}
class Dot {
constructor() {
this.x = random(width);
this.y = random(height);
}
show() {
ellipse(this.x, this.y, 20, 20);
}
}