Tuesday, April 9, 2013

Karin & Kristina // Experimenting with Processing: Mouse 2D















Code:   This is the "Mouse 2D" base code from 'Processing' that we customized to test out the workings of this model.  While this is our initial stages in figuring out how the language works, much experimenting is needed for us to later use it towards something functional!!



/**
* Mouse 2D.
*
* Moving the mouse changes the position and size of each box.
*/

void setup()
{
size(640, 360);
noStroke();
rectMode(CENTER);
ellipseMode(RADIUS); // Set ellipseMode to RADIUS
}

void draw()
{
background(300,300, 100);
fill(500, 204, 0, 90);
rect(mouseX, height/2, mouseY/6+10, mouseY/2+10);
fill(255, 40, 0, 100);
int inverseX = width-mouseX;
int inverseY = height-mouseY;
rect(inverseX, height/2, (inverseY/2)+10, (inverseY/2)+10);
fill(600, 139, 206, 63);
ellipse(mouseX+20, height-150, (inverseY), (inverseY)); // Draw white ellipse using RADIUS mode
// Set fill to white
}

No comments:

Post a Comment