void setup(){
size(400,300);
frameRate(100);
}
float []y = {200,170,180,190,200};
float []x = {230,300,140,50,375};
int []r = {5,10,20,15,25};
float []R = {255,255,0,100,255};
float []G = {255,0,255,255,100};
float []B = {0,255,255,100,255};
float []speed = {1.25,1.5,2,1.75,2.5};
float Red = 180 ;
float Green = 250 ;
float Blue = 200 ;
void draw(){
background(Red,Green,Blue);
Red = Red + 0.1 ;
if(Red>=255){Red=180;}
Green = Green + 0.1 ;
if(Green>=255){Green=250;}
Blue = Blue + 0.1;
if(Blue>=255){Blue=200;}
for(int i = 0; i<y.length;i++){
draw_balloon(x[i],y[i],r[i],R[i],G[i],B[i]);//yellow
y[i]=y[i] - speed[i];
if(y[i]<-120){
y[i] = 350 ;
R[i]=random(100,255);
G[i]=random(100,255);
B[i]=random(100,255);
x[i]=random(0,400);
}
}
}
void draw_balloon(float x,float y,int r,float R,float G,float B){
fill(R,G,B);
ellipse(x,y,2*r+50,2*r+60);
line(x,y+r+30,x,y+r+100);
triangle(x-5,y+r+35,x,y+r+30,x+5,y+r+35);
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น