> show canvas only <


/* built with Studio Sketchpad: 
 *   https://sketchpad.cc
 * 
 * observe the evolution of this sketch: 
 *   https://dflab.sketchpad.cc/sp/pad/view/ro.QDWrHXIJuEG/rev.1208
 * 
 * authors: 
 *   Carmen Esteves

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



// as instruções que estiverem dentro desta função setup() 
// correm uma vez quando o programa arranca


void setup() {  
      size(300, 300); 
} 
 
 float x = 0;
float y = 150;

float end_x = 300;
float end_y = 150;

float vx = 1;
float vy = 0;
 
 void draw() {
    background(#000033);
    fill(255)
    ellipse(100, 80, 130, 130);
    
    ellipse(225, 80, 130, 130);
    fill(#000000)
    ellipse( 200, 120, 20, 20);
    fill(#000000)
    ellipse(120, 120, 20, 20);
    
    // aplicar vector de deslocamento
    x = x + vx;
    y = y + vy;
 
    fill(#990033);
    rect(x, y, 200, 150);
    
    if (dist (x,y, end_x, end_y) < 5) {
        x = 0;
        y = 150;
        
    }

}