void setup() { size(600, 600); colorMode(RGB, 256, 256, 256); //noLoop(); } int depthlimit = 3; //float initialorbit=550; float rotation =0; float satratio = 0.29; float orbitdistance = 1; float xshift = 0; float yshift = 0; int colorshift = 0; int rshift = 10; int gshift = -10; int bshift = 15; int r = 237; int g = 99; int b = 8; int trans = 255; float zoomfactor = 1; int hide = 1; void draw() { // color the background float xcenter = width/2; float ycenter = height/2; background(r, g, b); //draw central circle, with diameter r1, yes dumb name. Should be d1 noStroke(); float r1 = width/4* zoomfactor; // r1 is actually diameter fill(255,255,255,trans); ellipse (xcenter+xshift, ycenter+yshift, r1, r1); draw2(xcenter, ycenter, r1, 1); //overwrite with blue text if (hide==1) { fill(0,0,0); float distancedisp = round(orbitdistance*100); distancedisp = distancedisp/100; float satratiodisp = round(satratio*1000); satratiodisp = satratiodisp/1000; float zoomfactordisp = round(zoomfactor*10); zoomfactordisp = zoomfactordisp/10; text("move (arrows): " + (round(-xshift)) + ", "+ (round(yshift)), 10, 10); text("zoom (+/-): " + zoomfactordisp,10,25); text("depth (>/<): " + depthlimit, 10, 40); text("orbit distance (w/s): " + distancedisp, 10, 55); text("satellite ratio (a/d): " + satratiodisp, 10, 70); text("color (c/x): " + r + ", " + g + ", " +b, 10,85); text("transparency (t): "+trans,10,100); text("hide/unhide (h)",10,115); } fill (255,255,255); text("mike", 560, 590); } void draw2(float xcenter, float ycenter, float r1, int level) { float r2 = r1*satratio; // r2 is actually diameter for (int i= 0; i < 8; i++) { float x = xcenter + cos(2*PI/8*i+rotation)*r1*orbitdistance; float y = ycenter + sin(2*PI/8*i+rotation)*r1*orbitdistance; fill(255,255,255,trans); ellipse (x+ xshift, y+ yshift, r2, r2); if (level < depthlimit) { draw2(x, y, r2, level+1); } else { } } } void keyPressed() { if (key == CODED) { if (keyCode == LEFT) { xshift +=25; } else if (keyCode == RIGHT) { xshift -=25; } else if (keyCode ==UP) { yshift +=25; } else if (keyCode ==DOWN) { yshift -=25; } } if (key == 'w') { orbitdistance +=0.05; } if (key == 's') { orbitdistance -=0.05; } if (key == 'd') { satratio +=.002; } if (key == 'a') { satratio -=.002; } if (key == 't') { trans = (trans - 32); if (trans<1) {trans=256;} } if (key == '+') { zoomfactor += 0.1; xshift = xshift*zoomfactor/(zoomfactor - 0.1); yshift = yshift*zoomfactor/(zoomfactor - 0.1); } if (key == '-') { zoomfactor -= 0.1; xshift = xshift*zoomfactor/(zoomfactor + 0.1); yshift = yshift*zoomfactor/(zoomfactor + 0.1); } if (key == '>') { depthlimit +=1;} if (key == '<' && depthlimit > 0) { depthlimit -=1;} if (key == 'c') { r = r + rshift; if (r>255) { r = 256+(256-r); rshift = -rshift; } if (r<0) { rshift = -rshift; r = -r; } g = g + gshift; if (g>255) { g = 256+(256-g); gshift = -gshift; } if (g<0) { gshift = -gshift; g = -g; } b = b + bshift; if (b>255) { b = 256+(256-b); bshift = -bshift; } if (r<0) { rshift = -rshift; r = -r; } } if (key=='h') { hide = -hide; } if (key == 'x') { r = r - rshift; if (r>255) { r = 256+(256-r); rshift = -rshift; } if (r<0) { rshift = -rshift; r = -r; } g = g - gshift; if (g>255) { g = 256+(256-g); gshift = -gshift; } if (g<0) { gshift = -gshift; g = -g; } b = b - bshift; if (b>255) { b = 256+(256-b); bshift = -bshift; } if (b<0) { bshift = -bshift; b = -b; } }}