/* DrunKanidnsky Copyright 2005 Sean McCullough banksean at yahoo */ Disc root = new Disc(); float scalingFactor = 2.0; int tick = 0; boolean doDraw = true; boolean drawTree = false; void setup() { tick=0; doDraw=true; framerate(20); size(400,400); smooth(); background(0); ellipseMode(CENTER); root.x = 200; root.y = 200; root.r = 100; root.addChildren(4,7); } void keyPressed() { if (key == ' ') { doDraw = !doDraw; } else if (key == 't' || key == 'T') { drawTree = !drawTree; } } void draw() { background(0); root.draw(); if (doDraw) { float bendAmt = 0.05*sin(tick*TWO_PI/500); root.bend(bendAmt); scalingFactor = 2.5+0.25*sin(tick*TWO_PI/25); tick++; } } void mousePressed() { setup(); } class Disc { int x, y; float r; float angleFromParent; Disc[] children; boolean isLeaf = false; color c = color(0); int countDown = (int)random(500); void draw() { if (tick > countDown) { fill(c); stroke(c); ellipse(x,y,r*2,r*2); } else { fill(0,0,0, 128); stroke(0,0,0,0); ellipse(x,y,r*2,r*2); } drawChildren(); } void drawChildren() { if (!isLeaf) { recalcFromAngle(); for (int i=0; i