> show canvas only <


/* built with Studio Sketchpad: 
 *   https://sketchpad.cc
 * 
 * observe the evolution of this sketch: 
 *   https://friendscentral.sketchpad.cc/sp/pad/view/ro.LgeXpHzGxJP/rev.225
 * 
 * authors: 
 *   Colin Angevine

 * license (unless otherwise specified): 
 *   creative commons attribution-share alike 3.0 license.
 *   https://creativecommons.org/licenses/by-sa/3.0/ 
 */ 



MyBouncer myBouncer;

void setup() {
    size(350, 500); 
    myBouncer = new MyBouncer();
} 

void draw() {
    background(255);
    myBouncer.move();
    myBouncer.display();
}


class MyBouncer {
    int x;
    int y;
    int speed;
    int radius;
    
    MyBouncer() {
        x = random(width);
        y = 10;
        speed = 5;
        radius = 5;
        fill(255, 0, 0);
    }
    
    void move() {
        y = y + speed;
        if (y > height || y < 0) {
            speed = -speed;
        }
    }
    
    void display() {
        ellipse(x, y, 50, 50);
    }
}