Question about how to create a loop with conditions (I'm new to programming)
in
Programming Questions
•
28 days ago
I'm reading the book Generative Art, by Matt Pearson
I have a circle that is drawn, then filled in, leaving traces behind.
What I would like to do is have it so that once the circle is filled in, it starts all over again, but this time have it so it stops at a shorter diameter each time it starts over, with a different color.
I know it has something to do with how I create the conditions, but I'm still trying to wrap my head around it.
here is my code:
- int diam=4;
- float centX, centY;
- void setup(){
- size(800,800);
- background(240,50,50);
- frameRate(25);
- smooth();
- stroke(250);
- strokeWeight(6);
- noFill();
- ellipse(width/2,height/2,width,height);
- centX=width/2;
- centY=height/2;
- stroke(0);
- strokeWeight(2);
- fill(240,150,150,5);
- }
- void draw(){
- if(diam<=800){
- ellipse(centX,centY,diam,diam);
- diam+=10;
- }
- }
Thank you so much for your help in advance!!!
1