Weird background stroke of a growing circle

Hello everyone! I’m very new to processing and have a few questions regarding this code:
It is supposed to be a growing and a shrinking circle, and it works, but the background is such a weird black pattern, that I don’t know how to get rid of. Does anyone have an idea? I’d like to incoorperate the variables into the void draw() but I don’t know how to do that


 int c = 0;
 int d = 500;
 
 void setup() 
{
  size(500, 500);
  background(200);
}

void draw() { 



 if ( c <= 500) {
   
  fill(270, 72, 204);
  circle(width/2, height/2, c); 
  c += 1;
  fill(200, 91, 71);
  circle(width/2, height/2, d);
  d -= 2;
 
  } else {
    
   c = 0;
   d = 500;
     
  }
}

Repeat this line at the start of draw()

yes I’ve tried that and it works, but I want to add another thing to draw that would be covered by the background then

Just draw it in draw() after the background command

Hi

May this close to your demand

void setup () {
size (600,600);
colorMode(HSB);
}
void draw(){
for(int i= 500; i >0; i=i -2) {
  stroke((i/2) + (mouseX/3), 255,255);
ellipse (300,300,i,i);
}
}


1 Like

Hello @hannymymy,

The default strokeWeight is 1 pixel.

What your are seeing is the black stroke (outline) of the circle being painted to the screen and generating moiré patterns:

Try adding stroke(2) to setup() and see what happens.

Reference:

Remove strokeWeight(2) and try adding noStroke() to setup() and see what happens.

Reference:

Have fun!

:)

1 Like