class Ball { float x,y,vx,vy,freq; float diam, opac,grav,b,speed; boolean sizeDecrease; Ball(float xpos, float ypos){ x = xpos; y = ypos; // grav = .05; speed = random(.1); //bounce back 80% //random velocity vx = random(-1,1); vy = random(-1,1); freq = .02; diam = random(10,30); opac = random(100,255); sizeDecrease = false; } void display(){ noStroke(); fill(255,opac); ellipse(x,y,diam,diam); } void move(){ x+= vx; y+= vy; //check for left edge if(x < diam){ vx = vx*-1; x = diam+1; } //check right edge if(x > width-diam){ vx = vx*-1; x = width-diam-1; } if(y < diam){ vy *= -1; y=diam+1; } } void change(){ if(diam < 95 && sizeDecrease == false){ diam += random(1,8); } else{ sizeDecrease = true; diam -= random(1,8); } if(diam <= 10){ sizeDecrease = false; } } }