float posY, r, g, b, diam;
int dirY;
void setup() {
size (1080, 720);
posY=height/2;
dirY=1;
r=0;
g=0;
b=0;
diam = 0;
}
void draw() {
posY = posY+5*dirY;
r+=1;
b+=0.01;
g = random(255);
diam+=0.01;
noStroke();
fill (255, 5);
rect (0, 0, width, height);
noStroke ();
fill (r, g, sin(b)*255);
ellipse (width/2, posY, sin(diam)*100, sin(diam)*100);
if (posY>height-diam/2||posY<0+diam/2) {
dirY=-dirY;
}
if (r>255) {
r=0;
}
}
No comments:
Post a Comment