//import processing.opengl.*; float a = 22; double phi=0.01, ddphi=0.01234, dphi=-0.01, dddphi=0.0000002; float dolly=-60, rSize, zStretch=0.1, stepSize=4.0, turnRate=0.01, xRot=0, yRot=0, xOld=0, yOld=0, transp=12, x=0, y=0; int i=0, limit=800, counter=0; boolean clearBackground=false, mouseControl=true; void setup() { size(400, 400, P3D); rSize = 6; noStroke(); fill(204, 204); frameRate(60); background(0); colorMode(HSB, 100); x=width/2; y=height/2; } void draw() { if (clearBackground) background(0); //translate(0,0, dolly); //ddphi+=dddphi; rotateX(xRot); rotateY(yRot); /*rotateX(PI/limit);*/ translate(x,y); rotateZ((float)phi); rotateY((float)dphi); fill(counter%255,255,255,a);//32.0*(limit-i)/limit); triangle(0,-rSize, rSize*2, 0 , 0, rSize); if (mouseControl){ dphi=(mouseX-width/2)*0.002; stepSize=16*(height-mouseY)/height; } phi+=dphi; x+=stepSize*cos((float)phi); y+=stepSize*sin((float)phi); if (x>width) x-=width; else if (x<0) x+=width; if (y>height) y-=height; else if (y<0) y+=height; counter++; // } //pointLight (255, 0, 255, 0, 0, 0); camera(); //lookat(); //endCamera(); if (keyPressed){ switch (keyCode){ case RIGHT: dphi+=ddphi; break; case LEFT: dphi-=ddphi; break; case UP: stepSize*=1.01; break; case DOWN: stepSize/=1.01; break; } switch (key){ case 'x': ddphi*=1.1; break; case 'z': ddphi/=1.1; break; } } } void keyPressed() { switch (key){ case 'R': case 'r': //phi=random(1.0); dphi=PI/random(100.0); if (random(1)>0.5) dphi=-dphi; ddphi=1/random(256.0); break; case 'c': background (0); break; case 'b': clearBackground=!clearBackground; break; case '-': case '_': dolly-=8; break; case '+': case '=': dolly+=8; break; case 's': saveFrame ("curlicor-###.png"); break; case 't': transp-=4; if (transp<0) transp=16; a=255-sqrt(transp)*63; break; case 'h': dddphi=0.000002/limit; break; } } void mousePressed() { mouseControl=!mouseControl; } /*void mouseDragged() { yRot+=turnRate*(mouseX-pmouseX); xRot-=turnRate*(mouseY-pmouseY); }*/ void setSeed(double seed) { ddphi=seed*TWO_PI; }