xxxxxxxxxx
57
var vels=[];
var arrx=[];
var arry=[];
var cycles=[];
var basespeed=20;
var cyclelim=50;
var numballs=15;
var ballsize=50;
function setup() {
createCanvas(1000, 1000);
for(var i=0; i<numballs; i++)
{
vels[i]=basespeed+ (i*1.019);
arrx[i]=width/2;
arry[i]=ballsize+(i*ballsize);
cycles[i]=0;
}
}
function draw() {
background(0);
fill('silver');
for(var i=0; i<numballs; i++)
{
circle(arrx[i], arry[i], ballsize);
}
udate();
}
function udate()
{
for(var i=0; i<numballs; i++)
{
if((arrx[i]+vels[i]<=width-(ballsize/2)) && (arrx[i]+vels[i]>ballsize/2))
{
arrx[i]+=vels[i]
}
else
{
vels[i]*=-1;
arrx[i]+=vels[i];
// cycles[i]++;
}
}
}