void doUI() { background(40); noStroke(); fill(60); rect(10,50,480,400); fill(120,140,155); textFont(uifont,20); textMode(CORNER); text("SPRING BODY",10,450); if(rawr.nodes.length>=maxNodes) fill(160,120,120); else fill(120); textFont(uifont,12); text("point mass: "+rawr.nodes.length,10,20); fill(120); text("spring tension: "+float(int(rawr.tension*1000))/1000,90,20); text("collision tension: "+float(int(rawr.collisionTension*1000))/1000,90,30); text("friction constant: "+FRICTION_FORCE,200,20); text("display mode: "+displayMode,200,30); fill(150); textFont(uifont,15); text("key",20,476); textFont(uifont,12); if(key=='p'||playMode) fill(120,220,190); else fill(150); text("'p' play mode",55,470); if(key=='1'||key=='2') fill(120,220,190); else fill(150); text("'1-2' display modes",55,488); /* if(key=='+') fill(220,190,190); else fill(150); text("'+' add node",55,488); */ if(key=='[') fill(220,190,190); else fill(150); text("'[' decrease tension",150,470); if(key==']') fill(220,190,190); else fill(150); text("']' increase tension",150,488); if(key=='g' || useGravity) fill(120,220,190); else fill(150); text("'g' toggle gravity",255,470); if(key=='c') fill(220,190,190); else fill(150); text("'c' clear",255,488); if(key=='s'||useSmooth) fill(220,190,190); else fill(150); text("'s' anti-alias",345,470); /* for(int i=0;i0.01) rawr.tension-=0.005; if(key==']'&&rawr.tension<0.7) rawr.tension+=0.005; if(key=='c') { playMode=false; selected=null; rawr=new lattice(0); } if(key=='1'||key=='2') displayMode=int(key)-48; if(key=='s') { if(useSmooth) { useSmooth=false; noSmooth(); } else { useSmooth=true; smooth(); } } } void keyReleased() { key=' '; }