/* * * by Evan Raskob * http://lowfrequency.org/interactivity/wiki/ * evan@flkr.com * * A Monster made out of body segments that follow one another. * - and googley eyes, of course. * * Keys: * * Spacebar makes it "explode" outwards. * + or = makes it get crazier * - or _ makes it more sedate. * */ // these are objects that follow // other Follower objects in interesting ways. // see below for details. Follower dude, eyeL, eyeR, eyeBallL, eyeBallR; Follower[] followers; float craziness = 10f; void setup() { size(512,512); ellipseMode(CENTER); colorMode(RGB, 1.0); smooth(); // the "dude" follows itself (the mouse, really) // this is the head dude = new Follower(); // these will be googly eyes eyeL = new Follower(dude); eyeL.nearness = 20f; eyeL.farness = 50f; eyeR = new Follower(dude); eyeR.nearness = 20f; eyeR.farness = 50f; eyeBallL = new Follower(eyeL); eyeBallL.lag = 0.6; eyeBallR = new Follower(eyeR); eyeBallR.lag = 0.6; // body segments followers = new Follower[80]; // first one follows the head followers[0] = new Follower(dude); for (int i=1; i0) r = sqrt( pow(followers[i-1].xpos-followers[i].xpos, 2) + pow(followers[i-1].ypos-followers[i].ypos, 2)); // draw ellipse centered at current segment position ellipse(followers[i].xpos,followers[i].ypos,r,r); } endShape(CLOSE); // set color for first follower and update/draw it fill(0f,1f); stroke(0f); //draw eyeballs fill (1f); eyeR.update(); eyeR.xpos -= 6f; ellipse(eyeR.xpos,eyeR.ypos,40,40); eyeL.update(); eyeL.xpos += 6f; ellipse(eyeL.xpos,eyeL.ypos,40,40); noStroke(); // draw pupils fill (0.1f,0f, 0.1f); eyeBallR.update(); ellipse(eyeBallR.xpos,eyeBallR.ypos,20,20); eyeBallL.update(); ellipse(eyeBallL.xpos,eyeBallL.ypos,20,20); } void keyPressed() { if (key == ' '){ for (int i=1; i