Can someone help me with this code please?

Hello, I am currently trying to make a simple circle fractal. I for some reason am not getting the largest circles/the starting ones. Here is my code:

void setup() {
  size(640,360);
}

void draw() {
  background(255);
  drawCircle(width/2,height/2,200);

}

void drawCircle(float x, float y, float radius) {
  ellipse(x, y, radius, radius);
  if(radius > 8) {
    drawCircle(x + radius/2, y, radius/2);
    drawCircle(x - radius/2, y, radius/2);
    drawCircle(x, y + radius/2, radius/2);
    drawCircle(x, y - radius/2, radius/2);
  }
}

This text will be hidden
This is what I get:help
This is what I should get: https://imgur.com/a/rolMWch (sorry I cant do built in the forums only allow me one picture)

1 Like
void setup() {
  size(640,360);
  noFill();
}

works here

2 Likes

Thanks it works but, why does it work? @kll

1 Like

filled circles would appear only the last visible, also depending if you start with what size first…

the processing defaults seems to be

fill(white)
stroke(black) strokeWeight(1)

where you find that recursive code?

1 Like