Files
sunny9898/task8/wk7/wk7_example6b/wk7_example6b.pde
louiscklaw 5637fbf94f update,
2025-02-01 02:07:58 +08:00

51 lines
806 B
Plaintext

float x, y, d;
float t_x = 10, t_y = 20, t_r=30, t_g=40, t_b=50, t_a=60;
void setup() {
fullScreen();
stroke(0, 100);
background(0);
noCursor();
}
void draw() {
if (d>1) {
float r = noise(t_r) * 255;
float g = noise(t_g) * 100;
float b = noise(t_b) * 100;
float a = noise(t_a) * 50;
fill(r, g, b, a);
ellipse(x, y, d, d);
t_x += 0.005;
t_y += 0.005;
t_r += 0.01;
t_g += 0.005;
t_b += 0.005;
t_a += 0.0001;
x += noise(t_x) * 10 - 5;
y += noise(t_y) * 10 - 5;
d -= 0.5;
}
else {
x = random(width);
y = height/2;
d = random(50, 200);
}
}
//void mousePressed() {
// if (d<1) {
// d = random(50, 200);
// x = mouseX;
// y = mouseY;
// }
//}
void keyPressed() {
if (d<1 && key==' ')
background(0);
}