-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBlips.pde
52 lines (47 loc) · 1.03 KB
/
Blips.pde
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
Ball[] balls = new Ball[30];
void setup(){
fullScreen();
background(255);
frameRate(30);
ellipseMode(CENTER);
noStroke();
for (int i = 0; i < 30; i++){
balls[i] = new Ball();
}
}
void draw(){
background(255);
for (int i = 0; i < 30; i++){
fill(balls[i].r,balls[i].g,balls[i].b,180-balls[i].perc*180);
ellipse(balls[i].x,balls[i].y,displayDensity*balls[i].maxdiam*balls[i].perc,displayDensity*balls[i].maxdiam*balls[i].perc);
balls[i].update();
}
}
class Ball{
float x;
float y;
float maxdiam;
float perc;
float r,g,b;
public Ball(){
this.r = random(256);
this.g = random(256);
this.b = random(256);
this.x = random(width);
this.y = random(height);
this.maxdiam = 25 + random(150);
this.perc = random(1);
}
public void update(){
this.perc+=0.004;
if (this.perc >= 1){
this.r = random(256);
this.g = random(256);
this.b = random(256);
this.x = random(width);
this.y = random(height);
this.maxdiam = 25 + random(150);
this.perc = 0;
}
}
}