-
Notifications
You must be signed in to change notification settings - Fork 9
/
Beautiful_Graphic.pde
123 lines (103 loc) · 2 KB
/
Beautiful_Graphic.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/*Author: Yarong Liu
Function: draw nine grids and eveyone contains particular shape
*/
void setup(){
size(600,600);
frameRate(15);
}
float ra ,rb,rc,rd,re,rf,rg,rh;
float ratio = 0.0, qratio1 = 0,qratio2 = 0,c,a,l1,l2,l3,l4;
int count = 60, Nframe = 0,y=0;
void draw(){
background(255); //<>//
circle();
ring();
line();
cross();
bounce();
Orcircle();
Rcircle();
voice();
Cquad();
Nratio();
}
void circle(){
fill(0);
if (ra<=10){ra = 10;}
ellipse(100,100,ra,ra);
}
void ring(){
if(c<0.6){y= y+10;stroke(y);}
else{stroke(0);strokeWeight(c);y=0;};
noFill();
ellipse(300,100,rb,rb);
}
void line(){
fill(0);
noStroke();
rect(497,140-rc, 6,50);
}
void cross(){
noStroke();
fill(0);
push();
translate(100,300);
rotate(radians(rd));
rect(-3,-20,6,40);
rect(-20,-3,40,6);
pop();
}
void bounce(){
fill(0);
ellipse(300+a,300+re,30,30);
}
void Orcircle(){
fill(0);
push();
translate(500,300);
rotate(radians(rf));
ellipse(0,-20,10,10);
ellipse(0,20,10,10);
pop();
}
void Rcircle(){
stroke(0);
strokeWeight(1.5);
fill(255);
ellipse(100,500,50,50+rg);
}
void voice(){
fill(0);
quad(265,550-l1,275,550-l1,275,550,265,550);
quad(285,550-l2,295,550-l2,295,550,285,550);
quad(305,550-l3,315,550-l3,315,550,305,550);
quad(325,550-l4,335,550-l4,335,550,325,550);
l1 = random(0,100*qratio2);
l2 = random(0,100*qratio2);
l3 = random(0,100*qratio2);
l4 = random(0,100*qratio2);
}
void Cquad(){
stroke(0);
strokeWeight(1.5);
fill(255);
quad(480-rh,500,500,470-rh,520+rh,500,500,530+rh);
}
void Nratio(){
Nframe = frameCount % count;
ratio = Nframe / 60.0;
qratio1 = pow(ratio-1,2);
qratio2= pow(ratio-1, 4);
c = 5*qratio2;
rb =100*(1-qratio1);
ra =100*qratio1;
rc = rc + 10*qratio2;
if(rc>=120){rc = 0;}
rd = rd + 7.8*qratio2;
if(rd>=90){rd = 0;}
re = 30-100*ratio+50*ratio*ratio;
a = random(-10*qratio1,10*qratio1);
rf = 180*qratio2;
rg = 50*(1-qratio1);
rh = 20*(1-qratio1);
}