Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Funzioni ricorsive + mousePressed()
/*
* Funzioni Ricorsive: drawCircle()
* by Federico Pepe
*
*/
int rec = 1;
void setup() {
size(700, 400);
noFill();
background(255);
}
void draw() {
background(255);
drawCircle(width/2, height/2, width/2, rec);
}
void drawCircle(int x, int y, int radius, int recursion) {
ellipse(x, y, radius, radius);
if (recursion > 1) {
recursion--;
drawCircle(x + radius/2, y, radius/2, recursion);
drawCircle(x - radius/2, y, radius/2, recursion);
}
}
void mousePressed() {
rec++;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.