A work in progress
September 26th, 2011

## Bouncing Ball

Source Code
``` float x=0;
float y=0;

float color1=0;
float color2=0;
float color3=0;

float velocity_x=7;
float velocity_y=3;

float x_length = 800;
float y_length = 800;

float diameterc = 150;

float x_left_bound;
float x_right_bound;

float y_upper_bound;
float y_lower_bound;

float diameter_increase;

void setup() {

size(800,800);

}

void draw() {

background(125,125,125);

fill(color1,color2,color3);

x_left_bound = diameterc/2;
x_right_bound = x_length-(diameterc/2);

y_upper_bound = diameterc/2;
y_lower_bound = y_length-(diameterc/2);

if ((x &rt; (x_right_bound-(velocity_x/2))) && (x < (x_right_bound+(velocity_x/2)))) {

velocity_x=velocity_x*-1;
color1 = random(255);
color2 = random(255);
color3 = random(255);

if ( diameterc <= 750) {
diameterc=diameterc+10;

}
}

else if ((velocity_x < 0) && (x < (x_left_bound-(velocity_x/2))) && (x &rt; (x_left_bound+(velocity_x/2))))

{

velocity_x=velocity_x*-1;
color1 = random(255);
color2 = random(255);
color3 = random(255);
if ( diameterc < 750) {
diameterc=diameterc+10;

}

}

if ((y &rt; (y_lower_bound-(velocity_y/2))) && (y < (y_lower_bound+(velocity_y/2)))) {

velocity_y=velocity_y*-1;
color1 = random(255);
color2 = random(255);
color3 = random(255);
if ( diameterc < 750) {
diameterc=diameterc+10;

}
}

else if ((velocity_y < 0) && (y < (y_upper_bound-(velocity_y/2))) && (y &rt; (y_upper_bound+(velocity_y/2))))  {

velocity_y=velocity_y*-1;
color1 = random(255);
color2 = random(255);
color3 = random(255);
if (diameterc < 750) {
diameterc=diameterc+10;

}

}

x=velocity_x+x;
y=velocity_y+y;

ellipse(x,y,diameterc, diameterc);

}```