/* Matt Martell IAT 800 - Dr. Christopher Shaw Due Oct. 6, 2008 A2-09 - Move two visual elements across the screen using the random() function as a generator of movement. Give each element a unique nonlinear motion. */ void setup() { background (3444); size(400,400); smooth(); stroke(230,230,250); frameRate(7); } //Variables float uPos = 100; float wPos = 100; float xPos = 10; float yPos = 10; void draw () { background (3444); //moving box rect (xPos, yPos, 15,15); xPos = xPos + random(25)*2; xPos++; if(xPos>width) xPos=0; yPos = yPos + random(25)/2; yPos++; if(yPos>height) yPos=0; //moving box in relation to mouse position rect (uPos, wPos, 15,15); uPos = mouseX/random(10) + random(5)/2; uPos++; if(uPos>width) uPos=0; wPos = mouseY/random(10) + random(5)/2; wPos++; if(wPos>height) wPos=0; }