a port of the Processing Visualization Language

Mouse2D

Moving the mouse changes the position and size of each box.

Original Processing.org Example: Mouse2D

// All Examples Written by Casey Reas and Ben Fry

// unless otherwise stated.

void setup() 

{

  size(200, 200); 

  noStroke();

  colorMode(RGB, 255, 255, 255, 100);

  rectMode(CENTER);

}



void draw() 

{   

  background(51); 

  fill(255, 80);

  rect(mouseX, height/2, mouseY/2+10, mouseY/2+10);

  fill(255, 80);

  rect(width-mouseX, height/2, ((height-mouseY)/2)+10, ((height-mouseY)/2)+10);

}
Fork me on GitHub