2010年12月26日日曜日

Learning fill command



float R,G,B,A;
int Rcounter=0;
int Gcounter=0;
int Bcounter=0;
int Acounter=0;


void setup(){
size(600,600);
background(0);
R=0;
G=0;
B=10;
A=0;
}

void draw(){
if(Acounter==0){
A++;
if(A==255){
Acounter=1;
}
}
else if (Acounter==1){
A--;
if(A==0){
Acounter=0;
ArandomSection();
}
}

if(Rcounter==0){
R++;
if(R==255){
Rcounter=1;
}
}
else if (Rcounter==1){
R--;
if(R==0){
Rcounter=0;
}
}

if(Gcounter==0){
G++;
if(G==255){
Gcounter=1;
}
}
else if (Gcounter==1){
G--;
if(G==0){
Gcounter=0;
}
}

if(Bcounter==0){
B++;
if(B==255){
Acounter=1;
ArandomSection();
}
}
else if (Bcounter==1){
B--;
if(B==0){
Bcounter=0;
}
}


fill(R,G,B,A);
ellipse(mouseX,mouseY,80,80);
}


void ArandomSection(){
R = random(0,255);
G = random(0,255);
B = random(0,255);
}





0 件のコメント:

コメントを投稿