-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRadar.pde
169 lines (128 loc) · 3.24 KB
/
Radar.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
class Radar
{
float range_away = 200;
float blip = 390;
float move = 0;
float range = 0;
float Sound_played = 0;
float radar_top = 55;
float expand = 0;
int x = 0;
int y = 0;
int x2 = 150;
int y2 = 0;
int x3 = 130;
int y3 = 50;
int x4 = 20;
int y4= 50;
int Box_move_x = 175;
int Box_move_y = 250;
int Box_move_x_2 = -455;
int Box_move_y_2 = -300;
void drawradar()
{
fill(0);
stroke(51, 102, 255);
//fixed double arc
arc(250, 250, 400, 400, -PI, 0); // upper half of circle
arc(250, 250, 200, 200, -PI, 0);
noFill();
//portions of arc
arc(250, 250, 230, 230, PI + 0.4 , PI + HALF_PI - 0.3);
arc(250, 250, 230, 230, PI + HALF_PI + 0.3, TWO_PI - 0.4);
arc(250, 250, 230, 230, PI + HALF_PI + 0.3, TWO_PI - 0.4);
arc(250, 250, 370, 370, PI + 1.25, TWO_PI - 1.25);
arc(250, 250, 370, 370, PI, TWO_PI - 2.75);
arc(250, 250, 370, 370, PI + 2.75, TWO_PI);
//portion of lines
line(217, 140, 250, 250);
line(282, 140, 250, 250);
line(145, 205, 250, 250);
line(355, 205, 250, 250);
line(185, 61, 190, 75);
line(313, 61, 307, 74);
line(435, 173, 420, 178);
line(65, 173, 80, 178);
line(120, 100, 250, 250);
line(380, 100, 250, 250);
fill(0);
arc(250, 250, 200, 200, -PI, 0);
fill(51, 102, 255);
line(250, 50, 250, 175);
ellipse(250, 175, 7, 7);
if(expand == 400)
{
expand = 0;
if(Sound_played < 200)
{
file.play();
}
else if(Sound_played > 201 && Sound_played < 600)
{
file_2.play();
}
else if(Sound_played > 600)
{
file_3.play();
}
}
if(expand == blip)
{
if(Sound_played < 600)
{
noStroke();
ellipse(random(250 - range,250 + range),radar_top + move,10,10);
fill(128, 179, 255);
}
else
{
noStroke();
ellipse(random(250 ,250),radar_top + move,10,10);
fill(128, 179, 255);
}
}
//expanding arc
noFill();
arc(250, 250, expand, expand, -PI, 0); // upper half of circle
fill(51, 102, 255);
rect(50,250,400,100);
fill(0);
noStroke();
beginShape();
vertex(x + Box_move_x, y + Box_move_y);
vertex(x2 + Box_move_x, y2 + Box_move_y);
vertex(x3 + Box_move_x, y3 + Box_move_y);
vertex(x4 + Box_move_x, y4 + Box_move_y);
// etc;
endShape();
move = move + 0.1;
Sound_played = Sound_played + 0.5;
if(Sound_played > 300)
{
range = range - 0.12;
}
else
{
range = range + 0.12;
}
textSize(38);
fill(255, 0, 0);
text(range_away, 350,280);
if( range_away > 0)
{
range_away = range_away - 0.1;
expand = expand + 10;
}
pushMatrix();
fill(51, 102, 255);
rotate(PI);
beginShape();
vertex(x + 20 + Box_move_x_2, y + Box_move_y_2);
vertex(x2 + Box_move_x_2, y2 + Box_move_y_2);
vertex(x3 + Box_move_x_2, y3 + Box_move_y_2);
vertex(x4 + Box_move_x_2, y4 + Box_move_y_2);
// etc;
endShape();
popMatrix();
}
}