xxxxxxxxxx
let l=[],v=[],s=[];
const NUM =10;
function setup() {
createCanvas(windowWidth, windowHeight);
frameRate(60)
for(let i=0;i<NUM;i++){
l[i]=createVector(width/2,height/2);
v[i]=createVector(random(-3,3),random(-3,3));
s[i]=createVector(20,20);
}
}
function draw() {
background(0);
noStroke();
fill(random(255),random(255),random(255),127);
for(let i=0;i<NUM;i++){
ellipse(l[i].x,l[i].y,s[i].x,s[i].y);
l[i].add(v[i]);
if(l[i].x>width||l[i].x<0){
v[i].x=v[i].x*-1;
}
if(l[i].y>height||l[i].y<0){
v[i].y=v[i].y*-1;
}
v[i].x+=random(-0.5,0.5);
v[i].y+=random(-0.5,0.5);
s[i].x+=random(-1,1);
s[i].y+=random(-1,1);
}
}