xxxxxxxxxx
53
//for
//for in
//for of
//while
//do while
let colors = {
red: "#ff0000",
green: "#00ff00",
blue: "#0000ff",
}
class CircleClass {
constructor(x,y,radius) {
this.x = x;
this.y = y;
this.radius = radius;
}
paint() {
circle(this.x,this.y,2*this.radius);
}
}
let circles = [];
function setup() {
createCanvas(600, 600);
background(220);
let i=0;
for (let i=0;i<100;i++) {
let x = random(width)
let c = new CircleClass(x,random(height),50);
circles.push(c);
i++;
}
for (let i in circles) {
fill(random(255),random(255),random(255));
circles[i].paint();
}
}
function draw() {
//background(220);
}