/* Circle path / from Learning Processing p 213 / */ // A polar coordinate float or = 110; float cr = 130; float nr = 150; float hr = 70; float otheta = 1; float ctheta = 2; float ntheta = 0; float htheta = 0; PFont atomicNumber; PFont atomLabel; PFont fontBottomTitle; PFont fontTopTitle; void setup() { size (400, 450); background (255); smooth(); atomicNumber = loadFont("Verdana-12.vlw"); atomLabel = loadFont("Verdana-Bold-14.vlw"); fontBottomTitle = loadFont("Verdana-22.vlw"); fontTopTitle = loadFont("Verdana-32.vlw"); //textFont(atomicNumber); } void draw() { // Set ellipses and rects to CENTER mode ellipseMode(CENTER); rectMode(CENTER); background (255); // redraw background so only see the box fill (255, 255, 255, 12); // last integer is opacity < 25% so can see all lines //ellipse (width/2, height/2, 2*or, 2*or); // makes circle same size as Oxygen atom path // next two make nice ellipse pattern that could follow atoms //ellipse (width/2, height/2, 100, 300); //ellipse (width/2, height/2, 300, 100); // Polar to Cartesian conversion float ox = or * cos (otheta); float oy = 1.3*or * sin (otheta); // Changed these with a factor to float cx = 1.2*cr * cos (ctheta); // get a more elliptical orbit float cy = cr * sin (ctheta); float nx = nr * cos (ntheta); float ny = nr * sin (ntheta); float hx = hr * cos (htheta); float hy = hr * sin (htheta); // Title at top and bottom fill (0); textAlign(CENTER); textFont(fontTopTitle); text ("EaSSIL", width/2, 40); textFont(fontBottomTitle); text ("Environmental Science", width/2, height-30); text ("Stable Isotope Laboratory", width/2, height-10); // nucleaus fill (0); ellipse (width/2, height/2, 50, 50); fill (255); textFont(atomLabel); textAlign(CENTER); text ("ESF", width/2, height/2+5); // oxygen box fill(59, 41, 237); rect (ox+width/2, oy+height/2, 55, 55); fill (0); textAlign(CENTER); textFont(atomLabel); text ("O", ox+width/2, oy+height/2+5); textFont(atomicNumber); text ("8", ox+width/2, oy+height/2-11); text ("15.9994", ox+width/2, oy+height/2+20); // carbon box // Draw rectangle at x,y fill(23,149,87); rect (cx+width/2, cy+height/2, 55, 55); fill (0); textAlign(CENTER); textFont(atomLabel); text ("C", cx+width/2, cy+height/2+5); textFont(atomicNumber); text ("6", cx+width/2, cy+height/2-11); text ("12.0107", cx+width/2, cy+height/2+20); // nitrogen box fill(126, 240, 183); rect (nx+width/2, ny+height/2, 55, 55); fill(0); textAlign(CENTER); textFont(atomLabel); text ("N", nx+width/2, ny+height/2+5); textFont(atomicNumber); text ("7", nx+width/2, ny+height/2-11); text ("14.0067", nx+width/2, ny+height/2+20); // hydrogen box fill(221, 255, 8); rect (hx+width/2, hy+height/2, 55, 55); fill(0); textAlign(CENTER); textFont(atomLabel); text ("H", hx+width/2, hy+height/2+5); textFont(atomicNumber); text ("1", hx+width/2, hy+height/2-11); text ("1.00794", hx+width/2, hy+height/2+20); // Increment the angle (larger speeds it up) otheta += 0.03; ctheta += 0.02; ntheta += 0.02; htheta += 0.05; //saveFrame("eassil" + int(random(0, 1000)) + ".jpg"); }