Filement[] myFilements; int numFilements = 15; int springFactor = 4; int boxSize = 10; float xmag; float ymag; float newXmag; float newYmag; BFont metaBold; RotTracker myRotTracker = new RotTracker(); void setup(){ metaBold = loadFont("Meta-Bold.vlw.gz"); ellipseMode(CENTER_DIAMETER); noStroke(); lights(); //smooth(); size(640,480); framerate(30); myFilements = new Filement[numFilements]; for(int i=0;i0){ myRotTracker.run(); newXmag+=myRotTracker.xNavRot; newYmag+=myRotTracker.yNavRot; } } void mousePressed(){ myRotTracker.setAnchor(); } void mouseReleased(){ myRotTracker.releaseAnchor(); }/* void mouseDragged(){ //xRot=min(max(xRot+(clickY-mouseY)*0.0007,2.2),3.5); //yRot+=(clickX-mouseX)*0.0007; //newXmag = TWO_PI - mouseX/float(width) * TWO_PI + PI; //newYmag = TWO_PI - mouseY/float(height) * TWO_PI + PI; myRotTracker.run(); newXmag+=myRotTracker.xNavRot; newYmag+=myRotTracker.yNavRot; }*/ class Filement{ float destScale; float curScale; float destX; float destY; float destZ; float curX; float curY; float curZ; // float curTextRot; float destTextRot; boolean rolledOver; boolean showMe; boolean showChildren; void run(){ curScale += (destScale-curScale)/springFactor; curX += (destX-curX)/springFactor; curY += (destY-curY)/springFactor; curZ += (destZ-curZ)/springFactor; drawFilement(); } void drawFilement(){ push(); translate(width/2,height/2); rotateX(ymag); rotateY(-xmag); translate(curX,curY,curZ); if(rolledOver){ noStroke(); fill(255,255,0); box(boxSize); stroke(255,0,0,255); fill(255,0,0,128); box(boxSize*1.25); g.lightKind[2] = DIFFUSE; g.lightX[3] = curX ; g.lightY[3] = curY ; g.lightZ[3] = curZ ; g.lightR[3] = 50.0; g.lightG[3] = 50.0; g.lightB[3] = 50.0; push(); noStroke(); fill(255,0,0,255); rotateY(xmag); rotateX(-ymag); noLights(); textFont(metaBold, 28); text("filename.txt", 12,6); lights(); stroke(255,255,255,128); pop(); } else { g.lightKind[3] = DISABLED; push(); noStroke(); fill(255,255,255,128); rotateY(xmag); rotateX(-ymag); textFont(metaBold, 12); text("filename.txt", 10,2); stroke(255,255,255,255); fill(255,255,255,128); pop(); box(boxSize); } pop(); } } class RotTracker{ float anchorX = -1; float anchorY = -1; float xPos; float yPos; float xNavRot; float yNavRot; float navRotDist; void run(){ testRot(); navRotDist = dist(anchorX,anchorY,mouseX,mouseY); stroke(0,255,0,255); fill(0,255,0,255); ellipse(anchorX,anchorY,10,10); ellipse(mouseX,mouseY,5,5); line(anchorX,anchorY,mouseX,mouseY); noFill(); ellipse(anchorX,anchorY,navRotDist*2,navRotDist*2); } void setAnchor(){ anchorX = mouseX; anchorY = mouseY; } void releaseAnchor(){ anchorX = -1; anchorY = -1; } void testRot(){ xNavRot = (anchorX-mouseX)/1000; yNavRot = (anchorY-mouseY)/1000; } }