Sorry because I know this is a very simple question but I’m stuck on this and I need help.

I’m trying to create the conditions to grow a circle up to a certain point, and when it reaches that point, make it smaller (also up to a certain point, and so on). I see is similar to other topics but I think this is a different way to make it.

“tamanyo” is the variable for the original size of the circle, and “a” is the variable I am using to grow and then shrink the circle.

This is my code:

float a=0;
float tamanyo=50;
void setup(){
size(400,400);
}
void draw(){
background(0);
noFill();
stroke(255);
circle(width/2,height/2,tamanyo);
tamanyo +=a;
if (a<=0) {
a++;
}
if (a == 20){
a--;
}
}

Then when updating diam w/ growth, check if diam has reached either min or max diameters; if so negate the current growth speed: if ( (diam += growth) <= MIN_DIAM || diam >= MAX_DIAM ) growth *= -1;