topical media & game development
graphic-processing-learning-13-example-13-8-example-13-8.pde / pde
// Learning Processing
// Daniel Shiffman
// http://www.learningprocessing.com
// Example 13-8: Recursion
void setup() {
size(200,200);
smooth();
}
void draw() {
background(255);
stroke(0);
noFill();
drawCircle(width/2,height/2,100);
}
void drawCircle(float x, float y, float radius) {
ellipse(x, y, radius, radius);
if(radius > 2) {
// drawCircle() calls itself twice, creating a branching effect.
// For every circle, a smaller circle is drawn to the left and right.
drawCircle(x + radius/2, y, radius/2);
drawCircle(x - radius/2, y, radius/2);
}
}
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.