Lab4-Ripple by Processing Iteration&Condition

 

 

Final Effects:

 

Code by Myself
int radius=30;
int i=1;
float x=random(width);
float y=random(height);

void setup(){
size(400,400);
background(200);
frameRate(30);
}

void draw(){
i+=5;
circles(x,y,i);
if (i>200){
x=random(width/4,3*width/4);
y=random(height/4,3*height/4);
i=1;
background(200);
}
}

void circles(float x,float y,int i){
for (int n=int(random(4,8)); n>0; n–){
println(n);
noStroke();
fill(30,200-10*n,255);
ellipse(x,y,n*radius+i,n*radius+i);
}
}

Leave a Reply