Hi, I am very new to coding and have a question regarding the code below. I’d like it to grow the circle with the count_up, but when one of the circles reaches the max width to go back again (in a way to loop the action) I was trying to make this happen witjh if…else but I don’t know how I should define the if so that it’s working.
Thank you so much in advance!!
int count_up = 0;
int count_down = 500;
void setup()
{
size(500, 500);
}
void draw() {
if ( count_up < width/2) {
fill(170, 172, 204, 150);
circle(width/2, height/2, count_up);
count_up += 1;
fill(250, 191, 171, 100);
circle(width/2, height/2, count_down);
count_down -= 2;
}
else {
fill(170, 172, 204, 150);
circle(width/2, height/2, count_up);
count_up -= 1;
fill(250, 191, 171, 100);
circle(width/2, height/2, count_down);
count_down += 2;
}
}
This is what the code is supposed to do but without growing indefinetly:
int count_up = 0;
int count_down = 500;
void setup()
{
size(500, 500);
}
void draw() {
background (233);
fill(170, 172, 204, 150);
circle(width/2, height/2, count_up);
count_up += 1;
fill(250, 191, 171, 100);
circle(width/2, height/2, count_down);
count_down -= 2;
}