/*Rieev Princer
Bouncing Ball
Digital Art: 245
July 9, 2012
*/
int x = 0;
int y = 1;
int speed = 1;
int circleX = 10;
int circleY = 10;
void setup (){
size(200,200);
smooth ();}
void draw (){
background (111,181,255);
x = x + speed;
if ((x > width)||(x < 0)) {
speed = speed * -1;
}
stroke (2,101,203);
fill (26, 130, 237);
ellipse (x,100,circleX,circleY);
circleX = circleX + 1;
circleY = circleY + 1;
y = y + circleY;
y = y +circleX;
if ((x > width)||(x < 0)) {
circleY = circleY * -1;
circleX = circleX * -1;}
}
No comments:
Post a Comment