/* Matt Martell IAT 800 - Dr. Christopher Shaw Due Oct. 6, 2008 A2-11 - Create a responsive image that behaves differently when the mouse is moving and the mouse is dragging. */ void setup() { size(400,400); smooth(); stroke(230,230,250); background(212,245,175); frameRate(7); } //Variables int value2 = 0; int value = 0; float x; float y; float z =180.0/PI; void draw() { fill(125,99,random(255),45); rect(x, y, 50, 50); } //Moves box on a path void mouseMoved() { x = z + sin(z)*10; y = z - cos(z)*10; z++; if (x>=width) { z=0; } } //Moves box around screen void mouseDragged() { fill (122,178,98); x = mouseX - random(50); y = mouseY - random(75); z++; if (x>=width) { z=0; } }