-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
325 lines (304 loc) · 15.5 KB
/
index.html
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Path Finding Visualization</title>
<meta property=”og:title” content="Path Finding Visualization"/>
<meta property=”og:description content="This is a web app written in javascript with the p5.js library to visualize path finding and maze generation algorithms. "/>
<meta property=”og:url” content="http://path-finding-visualization.yourdomain.com" />
<meta property=”og:url” content="http://path-finding-visualization.yourdomain.com" />
<meta property="og:image" content="images/meta.png" />
<link rel="shortcut icon" href="images/fav1.png" type="image/x-icon">
<link rel='manifest' href='/manifest.json'>
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@100;200;300;400;500;600;700;800;900&display=swap" rel="stylesheet">
<link rel="stylesheet" href="style/main.css">
<link rel="stylesheet" href="style/canvas.css">
</head>
<body>
<script>
import 'https://cdn.jsdelivr.net/npm/@pwabuilder/pwaupdate';
const el = document.createElement('pwa-update');
document.body.appendChild(el);
</script>
<input type="checkbox" id="playPause">
<div class="optionsMenu">
<section class="menu_section">
<input type="checkbox" name="menus" id="algorithms" tabindex="4">
<label for="algorithms" class="optionsMenu__algorithms dropdown" tabindex="4">
<span>
Algorithms
<svg viewBox="0 0 10 7">
<path d="M2 2 L5 5 L8 2"/>
</svg>
</span>
<ul>
<li>
<button id="bfs">
Breadth First
</button>
</li>
<li>
<button id="dfs">
Depth First
</button>
</li>
<li class="nested_menu">
<span>A* Search</span>
<ul>
<li>
<button id="a_star" algo_title="A* Search">
Uni-Directional
</button>
</li>
<li>
<button id="bi_a_star" algo_title="Bi-Dir A* Search">
Bi-Directional
</button>
</li>
</ul>
</li>
<li class="nested_menu">
<span>Dijkstra's</span>
<ul>
<li>
<button id="dijkstra" algo_title="Dijkstra's">
Uni-Directional
</button>
</li>
<li>
<button id="bi_dijkstra" algo_title="Bi-Dir Dijkstra's">
Bi-Directional
</button>
</li>
</ul>
</li>
<li>
<button id="greedy_search">
Greedy BFS
</button>
</li>
</ul>
</label>
<input type="checkbox" name="menus" id="mazes" tabindex="5">
<label for="mazes" class="optionsMenu__mazes dropdown" tabindex="5">
<span>
Mazes
<svg viewBox="0 0 10 7">
<path d="M2 2 L5 5 L8 2"/>
</svg>
</span>
<ul>
<li>
<button id="recursive_division">
Recursive Division
</button>
</li>
<li>
<button id="dps_maze">
Depth First Maze
</button>
</li>
<li>
<button id="krusal">
Krusal's Maze
</button>
</li>
<li>
<button id="prim">
Prim's Maze
</button>
</li>
<li class="nested_menu">
<span>random walls</span>
<ul>
<li>
<button class="random" id="random_high" value="0.5">
High Density
</button>
</li>
<li>
<button class="random" id="random_medium" value="0.3">
Medium Density
</button>
</li>
<li>
<button class="random" id="random_low" value="0.15">
Low Density
</button>
</li>
</ul>
</li>
<li>
<button id="stair">
Stair Pattern
</button>
</li>
</ul>
</label>
<label for="algorithms" id="algo_title">No Algorithm</label>
<button id="startButton">VISUALIZE!</button>
<div id="warning">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><line class="a" x1="10" y1="8.2" x2="10" y2="12.4"/><circle cx="10" cy="14.8" r="1"/><line class="a" x1="10" y1="2.3" x2="1.1" y2="17.7"/><line class="a" x1="10" y1="2.3" x2="18.9" y2="17.7"/><line class="a" x1="18.9" y1="17.7" x2="1.1" y2="17.7"/></svg>
<span>
<strong>WARNING:</strong> Algorithm may <strong>NOT</strong> produce shortest path
</span>
</div>
</section>
</div>
<div for="playPause" class="pausedScreen">
<label for="playPause">
<span>Program Paused</span>
<svg id="play" viewBox="0 0 20 20">
<path d="M18 10 L2 2 2 18 Z"/>
</svg>
</label>
</div>
<main>
<div class="canvas_wrap">
<div id="canvas"></div>
</div>
</main>
<footer>
<section class="buttons">
<label for="playPause" class="playPause" title="play/pause"
tabindex="1" onkeypress="if (event.keyCode == 13) document.getElementById('playPause').checked = !document.getElementById('playPause').checked">
<svg id="play" viewBox="0 0 20 20">
<path d="M18 10 L2 2 2 18 Z"/>
</svg>
<svg id="pause" viewBox="0 0 20 20">
<path d="M2 2 v16 h6 v -16 z"/>
<path d="M12 2 v16 h6 v -16 z"/>
</svg>
</label>
<button id="reset" tabindex="2" title="reset">
<svg viewBox="-2 -2 22 22">
<path d="M2 10 c0 4.418277 3.581723 8 8 8 s8 -3.581723 8 -8 -3.581723 -8 -8 -8 h-4 l3 3 -3 -3 3 -3"/>
</svg>
</button>
<button id="clear" tabindex="3" title="clear">
<svg viewBox="0 0 20 20">
<path d="M6 18 l-4 -4 11 -11 5 5 -8.7 8.7 -5 -5"/>
<path id="eraserPath" d="M16 18 h-10"/>
</svg>
</button>
</section>
<section class="settings">
<input type="checkbox" name="settings" id="settings">
<label class="settings__toggle" for="settings">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
<path d="M93.3652,60.6534a74.4955,74.4955,0,0,0-5.5-5.2363,37.933,37.933,0,0,0,0-10.8343,74.4537,74.4537,0,0,0,5.5-5.2363c1.4478-1.5287,2.7543-3.0377,3.9312-4.4982a2.3122,2.3122,0,0,0,.1861-2.6063L89.12,17.7579a2.3119,2.3119,0,0,0-2.35-1.1419c-1.8533.2889-3.8134.6659-5.8611,1.1554a74.5022,74.5022,0,0,0-7.2914,2.1471,38.199,38.199,0,0,0-9.3767-5.4227,74.442,74.442,0,0,0-1.7843-7.3779c-.6-2.0182-1.2535-3.9042-1.93-5.6536A2.3121,2.3121,0,0,0,58.3624,0H41.6376a2.3121,2.3121,0,0,0-2.1641,1.4643c-.6764,1.7494-1.33,3.6354-1.93,5.6536a74.442,74.442,0,0,0-1.7843,7.3779,38.199,38.199,0,0,0-9.3767,5.4227,74.5022,74.5022,0,0,0-7.2914-2.1471c-2.0477-.4895-4.0078-.8665-5.8611-1.1554a2.312,2.312,0,0,0-2.35,1.1419L2.5176,32.242a2.312,2.312,0,0,0,.186,2.6063c1.1769,1.46,2.4835,2.9695,3.9313,4.4982a74.4164,74.4164,0,0,0,5.5,5.2364,37.9226,37.9226,0,0,0,0,10.8342,74.4349,74.4349,0,0,0-5.5,5.2363c-1.4478,1.5287-2.7544,3.0378-3.9313,4.4982a2.312,2.312,0,0,0-.186,2.6063L10.88,82.242a2.3121,2.3121,0,0,0,2.35,1.142c1.8533-.289,3.8134-.6659,5.8611-1.1554a74.4769,74.4769,0,0,0,7.2915-2.1471,38.1984,38.1984,0,0,0,9.3766,5.4227,74.4337,74.4337,0,0,0,1.7843,7.3778c.6,2.0182,1.2535,3.9042,1.93,5.6536A2.3121,2.3121,0,0,0,41.6376,100H58.3624a2.3121,2.3121,0,0,0,2.1641-1.4644c.6764-1.7494,1.33-3.6354,1.93-5.6536a74.427,74.427,0,0,0,1.7843-7.3778,38.1958,38.1958,0,0,0,9.3767-5.4227,74.4746,74.4746,0,0,0,7.2914,2.1471c2.0477.49,4.0078.8664,5.8611,1.1554a2.312,2.312,0,0,0,2.35-1.142l8.3624-14.4841a2.312,2.312,0,0,0-.1861-2.6062C96.12,63.6912,94.813,62.1821,93.3652,60.6534ZM50,68.1035A18.1035,18.1035,0,1,1,68.1035,50,18.1036,18.1036,0,0,1,50,68.1035Z"/>
</svg>
<script>
window.onclick = function(e) {
if (e.target != document.getElementById("settings") && !document.querySelector(".settings__toggle").contains(e.target) && !document.querySelector(".settings__menu").contains(e.target)) {
document.getElementById("settings").checked = false;
}
}
</script>
</label>
<div class="background"></div>
<ul class="settings__menu">
<li>
<span class="title">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M16.5,2.4A10.8,10.8,0,0,0,10.7,0V3.1a6.1,6.1,0,0,1,3.7,1.5Z"/><path d="M20,9.2a10.8,10.8,0,0,0-2.4-5.7L15.4,5.6a6.1,6.1,0,0,1,1.5,3.6Z"/><path d="M16.9,10.8A6.9,6.9,0,0,1,10,17a7,7,0,0,1-7-7A6.9,6.9,0,0,1,9.2,3.1V0A10,10,0,1,0,20,10.8Z"/><path d="M14.4,5.6,9.3,8.5h0A1.6,1.6,0,0,0,8.4,10,1.6,1.6,0,0,0,10,11.6a1.6,1.6,0,0,0,1.5-.9h0Z"/></svg>
SPEED
</span>
<div class="options">
<input type="radio" name="speed" id="slow_speed" value="45">
<label for="slow_speed">
SLOW
</label>
<input type="radio" name="speed" id="avg_speed" value="30">
<label for="avg_speed">
MEDIUM
</label>
<input type="radio" name="speed" id="fast_speed" value="15" checked>
<label for="fast_speed">
FAST
</label>
</div>
</li>
<li>
<span class="title">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M10,11H9.5L1.7,6.4a1.1,1.1,0,0,1,0-1.8L9.5.1h1l7.8,4.5a1.1,1.1,0,0,1,0,1.8l-7.8,4.5ZM4.3,5.5,10,8.8l5.7-3.3L10,2.3Z"/><path d="M10,20H9.5A1.2,1.2,0,0,1,9,19V10a1.1,1.1,0,0,1,.5-.9l7.7-4.5a1.1,1.1,0,0,1,1.1,0,1.1,1.1,0,0,1,.5.9v9a1.1,1.1,0,0,1-.5.9l-7.8,4.5Zm1-9.4v6.5l5.7-3.2V7.3Z"/><path d="M10,20H9.5L1.7,15.4a1.1,1.1,0,0,1-.5-.9v-9a1.1,1.1,0,0,1,.5-.9,1.1,1.1,0,0,1,1.1,0l7.7,4.5a1.1,1.1,0,0,1,.5.9v9a1.2,1.2,0,0,1-.5.9ZM3.3,13.9,9,17.1V10.6L3.3,7.3Z"/></svg>
RENDERING
</span>
<div class="options">
<input type="radio" name="canvas_dimensions" id="twoD_canvas" value="twoD">
<label for="twoD_canvas">
2D
</label>
<input type="radio" name="canvas_dimensions" id="threeD_canvas" value="" checked>
<label for="threeD_canvas">
3D
</label>
</div>
</li>
<li>
<span class="title">
<svg id="neighbor_icon" class="remove_diag" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><circle class="diag" cx="3.2" cy="3.2" r="1.9"/><circle cx="10" cy="3.2" r="1.9"/><circle class="diag" cx="16.8" cy="3.2" r="1.9"/><circle class="diag" cx="3.2" cy="16.8" r="1.9"/><circle cx="10" cy="16.8" r="1.9"/><circle class="diag" cx="16.8" cy="16.8" r="1.9"/><circle cx="3.2" cy="10" r="1.9"/><circle cx="10" cy="10" r="1.9"/><circle cx="16.8" cy="10" r="1.9"/></svg>
NEIGHBORS
</span>
<div class="options">
<input type="radio" name="neighbors" id="orthogonal_neighbor" value="false" onclick="changeIcon(this)" checked>
<label for="orthogonal_neighbor">
ORTHOGONAL
</label>
<input type="radio" name="neighbors" id="diagonal_neighbor" value="true" onclick="changeIcon(this)">
<label for="diagonal_neighbor" onclick="">
ORTHOGONAL + DIAGONAL
</label>
<script>
function changeIcon(el) {
if (el.value == "true")
document.getElementById("neighbor_icon").classList.remove("remove_diag");
else
document.getElementById("neighbor_icon").classList.add("remove_diag");
}
</script>
</div>
</li>
<li>
<span class="title">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M6.1,17.1l-.4-.6H3.5V3.5H5.7l.4-.6L7,1.8H2.7a.9.9,0,0,0-.9.9V17.3a.9.9,0,0,0,.9.9H7Z"/><path d="M17.3,1.8H13l.9,1.1.4.6h2.2v13H14.3l-.4.6L13,18.2h4.3a.9.9,0,0,0,.9-.9V2.7A.9.9,0,0,0,17.3,1.8Z"/><path d="M10,19.7a1,1,0,0,1-1-1V1.3a1,1,0,0,1,2,0V18.7A1,1,0,0,1,10,19.7Z"/><path d="M10,19.7a1.2,1.2,0,0,1-.8-.4L6.8,16.4A1.1,1.1,0,0,1,6.9,15a1.2,1.2,0,0,1,1.5.1L10.8,18a1,1,0,0,1-.2,1.4A.7.7,0,0,1,10,19.7Z"/><path d="M10,19.7a.7.7,0,0,1-.6-.3A1,1,0,0,1,9.2,18l2.4-2.9a1.2,1.2,0,0,1,1.5-.1,1.1,1.1,0,0,1,.1,1.4l-2.4,2.9A1.2,1.2,0,0,1,10,19.7Z"/><path d="M7.6,5.2,6.9,5a1.1,1.1,0,0,1-.1-1.4L9.2.7A1,1,0,0,1,10.6.6,1,1,0,0,1,10.8,2L8.4,4.9A1.1,1.1,0,0,1,7.6,5.2Z"/><path d="M12.4,5.2a1.1,1.1,0,0,1-.8-.3L9.2,2A1,1,0,0,1,9.4.6a1,1,0,0,1,1.4.1l2.4,2.9A1.1,1.1,0,0,1,13.1,5Z"/></svg>
Rows
</span>
<label for="rows" class="slider">
<input type="range" min="3" max="40" step="1" value="21" id="row_slider">
<div id="rows_sld_value">
<span>21</span>
</div>
</label>
</li>
<li>
<span class="title">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2.9,6.1l.6-.4V3.5h13V5.7l.6.4,1.1.9V2.7a.9.9,0,0,0-.9-.9H2.7a.9.9,0,0,0-.9.9V7Z"/><path d="M17.1,13.9l-.6.4v2.2H3.5V14.3l-.6-.4L1.8,13v4.3a.9.9,0,0,0,.9.9H17.3a.9.9,0,0,0,.9-.9V13Z"/><path d="M18.7,11H1.3a1,1,0,0,1,0-2H18.7a1,1,0,0,1,0,2Z"/><path d="M15.8,13.4a1.1,1.1,0,0,1-.8-.3,1.2,1.2,0,0,1,.1-1.5L18,9.2a1,1,0,0,1,1.3,1.6l-2.9,2.4Z"/><path d="M18.7,11l-.7-.2L15.1,8.4A1.2,1.2,0,0,1,15,6.9a1.1,1.1,0,0,1,1.4-.1l2.9,2.4a1,1,0,0,1,.1,1.4A.9.9,0,0,1,18.7,11Z"/><path d="M4.2,13.4l-.6-.2L.7,10.8A1,1,0,0,1,.6,9.4,1,1,0,0,1,2,9.2l2.9,2.4A1.2,1.2,0,0,1,5,13.1,1.1,1.1,0,0,1,4.2,13.4Z"/><path d="M1.3,11a.9.9,0,0,1-.7-.4A1,1,0,0,1,.7,9.2L3.6,6.8A1.1,1.1,0,0,1,5,6.9a1.2,1.2,0,0,1-.1,1.5L2,10.8Z"/></svg>
Columns
</span>
<label for="columns" class="slider">
<input type="range" min="3" max="40" step="1" value="21" id="column_slider">
<div id="columns_sld_value">
<span>21</span>
</div>
</label>
</li>
<li>
<span class="title">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M2.1,12.6a2.2,2.2,0,0,1,1.4.8V3.5h9.9a2.2,2.2,0,0,1-.8-1.4V1.8H2.7a.9.9,0,0,0-.9.9v9.9Z"/><path d="M18.1,7.4h-.2a2.2,2.2,0,0,1-1.4-.8v9.9H6.6a2.2,2.2,0,0,1,.8,1.4v.3h9.9a.9.9,0,0,0,.9-.9V7.4Z"/><path d="M1.6,19.4a1.1,1.1,0,0,1-.7-.3,1,1,0,0,1,0-1.4L17.7.9a1,1,0,0,1,1.4,0,1,1,0,0,1,0,1.4L2.3,19.1A.9.9,0,0,1,1.6,19.4Z"/><path d="M18.1,6.4H18a1,1,0,0,1-.9-1.1l.3-3.8A1,1,0,0,1,18.5.6a1.2,1.2,0,0,1,.9,1.1L19,5.5A.9.9,0,0,1,18.1,6.4Z"/><path d="M14.6,2.9a1,1,0,0,1-1-.9,1,1,0,0,1,.9-1L18.3.6a1.2,1.2,0,0,1,1.1.9,1,1,0,0,1-.9,1.1l-3.8.3Z"/><path d="M1.6,19.4a1.1,1.1,0,0,1-1-.9,1,1,0,0,1,.9-1.1L5.3,17a1.2,1.2,0,0,1,1.1,1,1,1,0,0,1-.9,1l-3.8.4Z"/><path d="M1.6,19.4H1.5a1.2,1.2,0,0,1-.9-1.1L1,14.5a1,1,0,0,1,1-.9,1.2,1.2,0,0,1,1,1.1l-.4,3.8A1,1,0,0,1,1.6,19.4Z"/></svg>
Size
</span>
<label for="size" class="slider">
<input type="range" min="10" max="50" step="1" value="30" id="size_slider">
<div id="size_sld_value">
<span>30</span>
</div>
</label>
</li>
<span id="signature">Designed and Developed by Marcos Eizayaga</span>
</ul>
</section>
</footer>
<script src="src/main.js" type="module"></script>
</body>
</html>