-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathsketch_190326c.pde
95 lines (84 loc) · 1.76 KB
/
sketch_190326c.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
int nb=750; // number of drops
int maxDrops =1000;
int minDrops=500;
int h,h1;
Drop[] drops=new Drop[maxDrops];
void setup(){
colorMode(RGB,255);
size(900,625,P3D);
smooth();
frameRate(30);
h = abs(height/3);
h1=h*2;
for (int i = 0; i < maxDrops; i++){
drops[i] = new Drop(int(random(width)),-int(random(height*2)),(int)map((h+int(random(h1))),height*.35,height,0,height),1280);
}
}
void draw(){
fill(255,255,255);
stroke(255);
strokeWeight(0.5);
line(0,180,900,180);
strokeWeight(2);
line(50,625,400,181);
line(850,625,500,181);
quad(435,600,440,480,460,480,465,600);
quad(442,430,445,330,460,330,463,430);
quad(447,285,448,215,457,215,458,285);
gradient();
for (int i=0;i<nb;i++){
drops[i].fall();
}
}
void gradient(){
noStroke();
beginShape(QUADS);
fill(188,190,192);
vertex(0,0);
vertex(width,0);
fill(0,5,10);
vertex(width,height);
vertex(0,height);
endShape();
}
class Drop{
int x,y,d,z,onde,d1,oldY;
float acc;
boolean s;
Drop(int x,int y, int z, int d){
this.x=x;
this.y=y;
this.d=d;
this.z=z;
onde=0;
d1=d;
acc=0;
oldY=y;
}
void fall(){
if(y>0)acc+=0.2;
stroke(200,200,200,map(z,0,height,0,255));
strokeWeight(1);
if (y<z){
y=int(y+4+acc);
line(x,oldY,x,y);
oldY=y;
}
else{
noFill();
stroke(175,175,175,175-map(onde,0,d,0,255));
strokeWeight(map(onde,0,d,0,4));
d=d1+(y-height)*4;
ellipse(x,y,onde/5,onde/20);
onde=onde+7;
if(onde>d){
onde=0;
acc=0;
x=int(random(width));
y=-int(random(height*2));
oldY=y;
d=d1;
}
}
}
}