xxxxxxxxxx
39
var e;
function setup() {
createCanvas(400, 400);
background(220);
e = new eli(true,null,null);
}
function draw() {
noLoop();
noFill();
e.display();
e.next();
}
class eli {
constructor(gen1,x,y){
if(gen1){
this.pos = createVector(random(width),random(height));
} else {
this.pos = createVector(x,y);
}
this.iterations = floor(random(3,9));
this.w = random(2,10);
this.h = random(2,10);
}
display(){
for(var i = 0; i < this.iterations; i++){
ellipse(this.pos.x,this.pos.y - 2.5 * i,this.w + 5 * i,this.h + 5 * i);
}
}
next(){
let x = this.iterations * cos(this.w) + this.pos.x;
let y = this.iterations * sin(this.h) + this.pos.y;
}
}