> show canvas only <


/* built with Studio Sketchpad: 
 *   https://sketchpad.cc
 * 
 * observe the evolution of this sketch: 
 *   https://dflab.sketchpad.cc/sp/pad/view/ro.0N2zR3UJS6z/rev.68
 * 
 * authors: 
 *   Maria Joao Costa
 *   

 * 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(400, 660);
  background(102);
} 

// as instruções que estiverem dentro desta função draw
// são executadas a cada novo frame

void draw() {
  // Call the variableEllipse() method and send it the
  // parameters for the current mouse position
  // and the previous mouse position
  variableEllipse(mouseX, mouseY, pmouseX, pmouseY);
 if (mousePressed) {
    fill(0);
  } else { 
    fill(300);}}


// The simple method variableEllipse() was created specifically 
// for this program. It calculates the speed of the mouse
// and draws a small ellipse if the mouse is moving slowly
// and draws a large ellipse if the mouse is moving quickly 

void variableEllipse(int x, int y, int px, int py) {
  float speed = abs(x-px) + abs(y-py);
  stroke(speed);
  rect(x, y, speed, speed);
}