Files
processing4/java/examples/Basics/Input/Mouse2D/Mouse2D.pde
benfry eb64b2d4fc
2011-01-26 19:22:19 +00:00

25 lines
417 B
Plaintext

/**
* Mouse 2D.
*
* Moving the mouse changes the position and size of each box.
*/
void setup()
{
size(200, 200);
noStroke();
rectMode(CENTER);
}
void draw()
{
background(51);
fill(255, 204);
rect(mouseX, height/2, mouseY/2+10, mouseY/2+10);
fill(255, 204);
int inverseX = width-mouseX;
int inverseY = height-mouseY;
rect(inverseX, height/2, (inverseY/2)+10, (inverseY/2)+10);
}