xxxxxxxxxx
28
var vetorX = [], vetorY = [], vetorD = [], vetorV = [], vetorCor = [];
var qtElementos = 100;
function setup() {
createCanvas(400, 400);
for (i=0; i < qtElementos; i++){
vetorX[i] = random(0,400);
vetorY[i] = random(0,400);
vetorD[i] = random(4,40);
vetorV[i] = random(1,10);
vetorCor[i] = random(0,255);
}
}
function draw() {
background(220);
for (i=0; i < qtElementos; i++){
vetorY[i] = vetorY[i] + vetorV[i];
fill(vetorCor[i]);
ellipse(vetorX[i] ,vetorY[i] ,vetorD[i],vetorD[i]);
if( vetorY[i] > 400 ){
vetorY[i] = random(-400,-100);
}
}
}