// W:Mute 2005 // www.wmute.org psystem ps; int nump; int mode; float ay,ax,aay,aax; vector3D offset; boolean rot,firstclick,drawing; framePoster fPost = new framePoster("tangle","tangle"); boolean SAVING; int saveLag; void setup(){ size(600,600,P3D); //hint(ENABLE_OPENGL_4X_SMOOTH); background(255); colorMode(HSB); frameRate(18); strokeWeight(2); //depth(); rot=drawing=true; firstclick=true; nump=81; go(); } void go(){ mode=nump; ay=ax=0.0; aay=random(-0.01,0.01); aax=random(-0.005,0.005); ps = new psystem(nump, 200.0); offset = new vector3D(-300,-300,0); calculate(); } void calculate(){ int count=0; while (count<127){ ps.update(0.5); count++; } } void draw(){ if (drawing){ background(255); ps.draw3D(offset,mode,0.5,ay,ax); ay+=aay; ax+=aax; } if(SAVING) saveLag--; if(saveLag<=0){ SAVING=false; saveLag=10; } } void mouseReleased(){ rot=!rot; if (rot){ drawing=true; ay=ax=0.0; aay=random(-0.01,0.01); aax=random(-0.005,0.005); } } void keyReleased(){ if ((key == ' ')&&(!SAVING)) { SAVING=true; fPost.postFrame(); } else{ rot=drawing=true; go(); } }