-
Notifications
You must be signed in to change notification settings - Fork 0
/
Clouds.pde
44 lines (41 loc) · 1.01 KB
/
Clouds.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
// Interpreting a class similar to landscape to interpret the clouds ellipses in the sky landscape
class Clouds {
Horizon[] points = new Horizon[1000];
int left, right;
int timer = 0;
float yy;
float shade;
float res;
Clouds(int b, float s, float r) {
res = r;
shade = s;
for (int i = 0; i < points.length; i++) {
float j = map(i, 0, points.length, 0, width);
points[i] = new Horizon(j, b, i);
}
}
void update(float speedx) {
timer-=3;
if (timer < 0) {
yy = random(-75, 75);
timer = int(random(25, 200));
}
for (int i = 0; i < points.length; i++) {
points[i].update(yy,speedx,res);
}
}
void display() {
pushMatrix();
scale(1.5, 1);
translate((-width/points.length)*2,0);
noStroke();
fill(255-shade,255-shade,255-shade);
beginShape();
for (int i = 0; i < points.length; i++) {
ellipse(points[i].x, points[i].y, 25,15);
}
vertex(points[0].x, points[0].y);
endShape();
popMatrix();
}
}