> show canvas only <


/* built with Studio Sketchpad: 
 *   https://sketchpad.cc
 * 
 * observe the evolution of this sketch: 
 *   https://dflab.sketchpad.cc/sp/pad/view/ro.gTwVJeF58id/rev.951
 * 
 * authors: 
 *   Ana

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



// This sketch builds on a prior work, "lauraferreira- 02", created by Laura Ferreira
// http://dflab.sketchpad.cc/sp/pad/view/ro.95R1z7VP4S2ydf/rev.2779
     
float recta1 = 2.0;
float recta2 = 185.0;
float recta3 = 200;

//posiçao inicial
    float x = 0.0; float a = 2; 
    float y = 0.0; float b = 0; 

// posiçao final
    float endx =150; float enda = 0; 
    float endy =0; float endb = 0; 

// vector deslocamento
    float vx= 1; float va = 1; 
    float vy= 0; float vb = 0; 

//corre uma vez apenas

void setup() {  
  size(400,400);
  frameRate(60);
  
}

 // sempre a correr ate que se diga para parar
 
void draw() { 

  background(100,117,67);
  fill(80,117,70);
  stroke(175,69,13);
  quad(0,0, 0,318, 500,318, 500,0);
  
 // recta do lado esquerdo 
 
  recta1 = recta1 - 5;
  if (recta1 < 0) {
    recta1 = 400;
  }
  stroke(255);
  strokeWeight(5);
  line(0, recta1, 300, recta1);

// recta lado esquerdo 3
  recta3 = recta3 - 1;
  if (recta3 < 0) {
    recta3 = 400;
  }
  stroke(255);
  strokeWeight(5);
  line(0, recta3, 220, recta3);
  
  // recta do lado direito
  
  recta2 = recta2 - 3;
  if (recta2 < 0) {
      recta2 = 400; }
      
      line(170, recta2 , 00, recta2);
      
          
// aplicar deslocamento
      
      //descomamento1
    x= x+vx;
    y= y+vy; 
    
    // deslocamento2
    a= a- va;
    b= b- vb;     
    

 // circulo 1
     
    fill(40,69,13);
         ellipse (x, y +recta1-10, 140,140);
    if (dist (x, y, endx, endy) < 2) {   
        x=0.0;
        y=0.0;  }
        
// circulo 2

    fill(232,197,20);
         ellipse (a,b + recta3-30, 80,80);
    if (dist (a, b, enda, endb) < 2) {   
        a=300;
        b=0;  } 
        
    fill(0);
    noStroke();
    rect (310, recta2, 6, recta2, 300, recta2);
 
    fill(0);
    noStroke();
    rect (290, recta2, 3, recta2, 400, recta2);
 
     fill(0);
    noStroke();
    rect (250, recta2, 3, recta2, 300, recta2);
    
     fill(0);
    noStroke();
    rect (230, recta2, 8, recta2, 300, recta2);
        
    
}