// spheroid builder // Brock Craft // // updated 06 april 2005 // let this run for about a dozen iterations for the full effect // this program saves files, if you uncomment the savefile() method // // Warning: this code ain't elegant - but it works! float xpos; // holds the x position float ypos; // holds the y position float fval=5; // a float tval=100; int textheight; int subtextheight; BFont f; boolean check=true; float factor=.00005; int count=0; void setup(){ size(500,500); //size(1000,1412); //golden ratio! background(255); fill(50,50,50,150); caption(); colorMode(HSB); stroke(0,250,20,60); // fill(0,250,105,250); } void loop(){ if (check=true){setstart();} for (int i=0; i<50; i++){ xpos=(width/2 + cos(fval)*tval); // magic math ypos=(height/2 + sin(fval)*tval); // more magic math fval=fval+.0005; // precision of the spiral - affects the curve too // tval=tval+5; // tightness of the spiral's curve // small changes make a big difference rotateX(ypos*.2); rotateY(ypos*factor); point(xpos, ypos); // draw it! count=count+1; if (count==200000){ // savefile(); UNCOMMENT THIS TO WRITE OUT FILES count=0; factor=factor*2.5; background(255); caption(); } } } void setstart(){ translate(250,100,-900); check=false; } void caption(){ if (check == false){fill(255);}else{fill(0);} textheight=47; println(width); subtextheight=textheight/2; BFont f = loadFont("Eurostile.vlw"); textMode(ALIGN_CENTER); textFont(f, textheight); text("s p h e r o i d", width/2, height-(textheight)); } // if you want to save a series of files (timestamped) // uncomment this code. // they look great when animated! /* void savefile() { int s = second(); // Values from 0 - 59 int m = minute(); // Values from 0 - 59 int h = hour(); // Values from 0 - 23 String stamp = ("rendered_"+h+"_"+m+"_"+s); save(stamp); println("File saved as: "+stamp); } */