> show canvas only <


/* built with Studio Sketchpad: 
 *   https://sketchpad.cc
 * 
 * observe the evolution of this sketch: 
 *   https://playgramming.sketchpad.cc/sp/pad/view/ro.GjHk8mmYHzR/rev.29
 * 
 * authors: 
 *   Devon Scott-Tunkin

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



// Processing Book, Casey Reas, pg. 280 Motion 1: Lines, Curves

float y = 50.0;
float speed = 1.0;
float radius = 15.0;
int direction = 1;

void setup() {
    size(100, 100);
    smooth();
    noStroke();
    ellipseMode(RADIUS);
}

void draw() {
    fill(0, 12);
    rect(0, 0, width, height);
    fill(255);
    ellipse(33, y, radius, radius);
    y += speed * direction;
    if ((y > height-radius) || (y < radius)) {
        direction = -direction;
    }
}