/** * "Ghost Nautilus"
* Move your mouse!
* Rob Weinberg - spindrift.org
* 3/12/08


* as other species of our era
* so also do We pass
* and with us our creature, Time.

* time forgotten wind and waves move
* neither after nor before;
* rain forms, landforms, brine and DNA
* reconfigure and some time
* something comes that hears
* and one more time knows Time.
* */ //Try changing numSpinBoxes int numSpinBoxes = 40; SpinBox mySpin[] = new SpinBox[numSpinBoxes]; void setup (){ size(770,500); frameRate(20); background(0); //create SpinBox instances but do not draw them yet for (int i=0; i < mySpin.length; i++){ //try variations on the spinFactor //determines rotation displacement of each fan with respect to its neighbors float spinFactor = (TWO_PI/40)*i; //(x location, y location, width, height, displacement) mySpin[i] = new SpinBox ( 220+8*i, 240, 48, 280, spinFactor ); } } void draw(){ //If noStroke is placed in "setup" it doesn't always work noStroke(); //The second number in "fill" determines amount of ghosting fill (0,12); rect(0,0,770,500); //Draw all of the the instances for (int i=0; i < mySpin.length; i++){ mySpin[i].spinMe(); } } class SpinBox { int x; int y; int xwid; int ywid; float spinAngle; //constructor - does not draw anything yet SpinBox (int x, int y, int xwid, int ywid, float spinAngle) { //x and y will only be used in "translate" this.x = x; this.y = y; this.xwid = xwid; this.ywid = ywid; //initial angle of rotation - will increment this later this.spinAngle = spinAngle; } //translate, rotate, and draw the instance void spinMe (){ fill(255,30); //Increase the angle of rotation this.spinAngle+=TWO_PI/156; // print(this.spinAngle+" ........... "); //bring back standard matrix pushMatrix(); //draw this instance always to the same place translate(this.x, this.y); //draw this instance with incremented angle of rotation rotate (this.spinAngle); // print(PI/(300)*this.spinAngle + " \n"); //draw the instance with some center of rotation rect (map(mouseX, 0, width, 0, 200)-this.xwid/3, map(mouseY, 0, height, 0, 100)-this.ywid/3, this.xwid, this.ywid); //return matrix as you found it popMatrix(); } }