// Draw a moving ball
float x, y;
   float deltaX, deltaY;
void setup() { // all sketch setup goes here
   size(400, 400);
   smooth();
 
 x = 0;
   y = height/2;
   deltaX = 1;
   deltaY = 1;
   } // setup()
void draw() {
   background(255);
   fill(255, 0, 0);
   ellipse(x, y, 25, 25);
   x = x + deltaX;
   y = y + deltaY;
   
   // make sure ball stays within bounds
   if (x >= width) {
   deltaX = deltaX * -1;
   }
   
   if (x <= 0) {
   deltaX = deltaX * -1;
   }
   
   if (y > height) {
   deltaY = deltaY * -1;
   }
   
   if (y < 0) {
   deltaY = deltaY * -1;
   }
   } // draw()