xxxxxxxxxx
35
var myCircles=[];
function setup() {
createCanvas(400, 400);
for (var i = 0 ; i <1000; i++) {
myCircles.push (new Circle());//create a baby
}
}
function draw() {
background(220);
for (var i =0 ; i < 400; i++) {
myCircles[i].displayIt();
}
}
class Circle {
constructor() {
this.radius=random (30);
this.x = random (width);
this.y = random (300);
this.angle;
}
displayIt() {
ellipse (this.x, this.y, this.radius, this.radius);
this.x += sin(this.angle);
this.x += random (-2,2);
this.angle += .1
//this.x = this.x + random
}
}