Optimize styles and layout
Browse files- index.html +426 -439
index.html
CHANGED
@@ -2,449 +2,436 @@
|
|
2 |
<html lang="en">
|
3 |
|
4 |
<head>
|
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 |
-
.checkbox-list::-webkit-scrollbar-thumb:hover {
|
170 |
-
background: #888;
|
171 |
-
}
|
172 |
-
</style>
|
173 |
</head>
|
174 |
|
175 |
<body>
|
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 |
-
</label>
|
202 |
-
<label>
|
203 |
-
<input type="radio" name="videoOption" value="take_the_item"> Take the item
|
204 |
-
</label>
|
205 |
-
<label>
|
206 |
-
<input type="radio" name="videoOption" value="twist_the_tube"> Twist the tube
|
207 |
-
</label>
|
208 |
-
</div>-->
|
209 |
-
|
210 |
-
<div class="video-container">
|
211 |
-
<video id="laptopVideo">
|
212 |
-
<source src="https://huggingface.co/datasets/cyberorigin/fold_towels/resolve/main/Video/video.mp4"
|
213 |
-
type="video/mp4">
|
214 |
-
Your browser does not support the video tag.
|
215 |
-
</video>
|
216 |
-
<div class="controls">
|
217 |
-
<button id="playPauseBtn">▶️</button>
|
218 |
-
<button id="rewindBtn">⏪</button>
|
219 |
-
<button id="forwardBtn">⏩</button>
|
220 |
-
<button id="restartBtn">↩️</button>
|
221 |
-
</div>
|
222 |
-
</div>
|
223 |
-
<div id="plotDiv"></div>
|
224 |
-
</div>
|
225 |
</div>
|
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 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
448 |
</body>
|
449 |
|
450 |
</html>
|
|
|
2 |
<html lang="en">
|
3 |
|
4 |
<head>
|
5 |
+
<meta charset="UTF-8">
|
6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
7 |
+
<title>Motion Capture Visualization</title>
|
8 |
+
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
|
9 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/PapaParse/5.3.0/papaparse.min.js"></script>
|
10 |
+
<link href="https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&display=swap" rel="stylesheet">
|
11 |
+
<!--'Orbitron', sans-serif;Arial, Helvetica, sans-serif-->
|
12 |
+
<style>
|
13 |
+
body {
|
14 |
+
margin: 0;
|
15 |
+
padding: 20px;
|
16 |
+
font-family: 'Orbitron', 'Arial', sans-serif;
|
17 |
+
background-color: #1a1a1a;
|
18 |
+
color: #ffffff;
|
19 |
+
min-height: 90vh;
|
20 |
+
}
|
21 |
+
|
22 |
+
h1 {
|
23 |
+
width: 1280px;
|
24 |
+
color: #ffffff;
|
25 |
+
margin: 0 auto 30px;
|
26 |
+
font-size: 30px;
|
27 |
+
text-shadow: 2px 2px 4px rgba(255, 255, 255, 0.5)
|
28 |
+
}
|
29 |
+
|
30 |
+
.main-container {
|
31 |
+
display: grid;
|
32 |
+
grid-template-columns: 250px 1fr;
|
33 |
+
gap: 20px;
|
34 |
+
max-width: 1280px;
|
35 |
+
margin: 0 auto;
|
36 |
+
height: calc(100vh - 80px);
|
37 |
+
}
|
38 |
+
|
39 |
+
/* Panel A: Episodes List */
|
40 |
+
#episodes-container {
|
41 |
+
background-color: #2a2a2a;
|
42 |
+
border-radius: 10px;
|
43 |
+
padding: 15px;
|
44 |
+
height: 90%;
|
45 |
+
overflow-y: auto;
|
46 |
+
}
|
47 |
+
|
48 |
+
#episodes-title {
|
49 |
+
color: #ffffff;
|
50 |
+
margin-top: 0;
|
51 |
+
padding-bottom: 10px;
|
52 |
+
border-bottom: 1px solid #3a3a3a;
|
53 |
+
}
|
54 |
+
|
55 |
+
#episodes-grid {
|
56 |
+
display: flex;
|
57 |
+
flex-direction: column;
|
58 |
+
gap: 4px;
|
59 |
+
margin-top: 15px;
|
60 |
+
}
|
61 |
+
|
62 |
+
.episode-radio {
|
63 |
+
padding: 8px;
|
64 |
+
border-radius: 6px;
|
65 |
+
transition: background-color 0.2s;
|
66 |
+
}
|
67 |
+
|
68 |
+
.episode-radio:hover {
|
69 |
+
background-color: #3a3a3a;
|
70 |
+
}
|
71 |
+
|
72 |
+
.episode-radio input[type="radio"] {
|
73 |
+
margin-right: 10px;
|
74 |
+
}
|
75 |
+
|
76 |
+
.episode-radio label {
|
77 |
+
cursor: pointer;
|
78 |
+
}
|
79 |
+
|
80 |
+
/* Right Content Container */
|
81 |
+
.content-container {
|
82 |
+
display: grid;
|
83 |
+
grid-template-columns: 1fr;
|
84 |
+
grid-template-rows: auto 1fr;
|
85 |
+
gap: 20px;
|
86 |
+
height: 100%;
|
87 |
+
}
|
88 |
+
|
89 |
+
/* Video Container */
|
90 |
+
.video-container {
|
91 |
+
display: flex;
|
92 |
+
flex-direction: column;
|
93 |
+
align-items: center;
|
94 |
+
background-color: #2a2a2a;
|
95 |
+
border-radius: 10px;
|
96 |
+
padding: 22px;
|
97 |
+
height: fit-content;
|
98 |
+
}
|
99 |
+
|
100 |
+
video {
|
101 |
+
width: 720px;
|
102 |
+
border-radius: 6px;
|
103 |
+
margin-bottom: 15px;
|
104 |
+
background-color: #000;
|
105 |
+
}
|
106 |
+
|
107 |
+
.controls {
|
108 |
+
display: flex;
|
109 |
+
gap: 10px;
|
110 |
+
justify-content: center;
|
111 |
+
padding: 10px 0;
|
112 |
+
}
|
113 |
+
|
114 |
+
.controls button {
|
115 |
+
background-color: #3a3a3a;
|
116 |
+
border: none;
|
117 |
+
border-radius: 6px;
|
118 |
+
padding: 4px 8px;
|
119 |
+
cursor: pointer;
|
120 |
+
transition: background-color 0.2s;
|
121 |
+
font-size: 18px;
|
122 |
+
}
|
123 |
+
|
124 |
+
.controls button:hover {
|
125 |
+
background-color: #4a4a4a;
|
126 |
+
}
|
127 |
+
|
128 |
+
/* Plot Container */
|
129 |
+
#plotDiv {
|
130 |
+
background-color: #2a2a2a;
|
131 |
+
border-radius: 10px;
|
132 |
+
padding: 15px;
|
133 |
+
width: 720px;
|
134 |
+
height: 550px;
|
135 |
+
}
|
136 |
+
|
137 |
+
#loadingIndicator {
|
138 |
+
position: fixed;
|
139 |
+
top: 50%;
|
140 |
+
left: 50%;
|
141 |
+
transform: translate(-50%, -50%);
|
142 |
+
background-color: rgba(0, 0, 0, 0.8);
|
143 |
+
padding: 20px 40px;
|
144 |
+
border-radius: 10px;
|
145 |
+
display: none;
|
146 |
+
}
|
147 |
+
|
148 |
+
/* Scrollbar Styling */
|
149 |
+
::-webkit-scrollbar {
|
150 |
+
width: 8px;
|
151 |
+
}
|
152 |
+
|
153 |
+
::-webkit-scrollbar-track {
|
154 |
+
background: #2a2a2a;
|
155 |
+
}
|
156 |
+
|
157 |
+
::-webkit-scrollbar-thumb {
|
158 |
+
background: #4a4a4a;
|
159 |
+
border-radius: 4px;
|
160 |
+
}
|
161 |
+
|
162 |
+
::-webkit-scrollbar-thumb:hover {
|
163 |
+
background: #5a5a5a;
|
164 |
+
}
|
165 |
+
|
166 |
+
</style>
|
|
|
|
|
|
|
|
|
|
|
|
|
167 |
</head>
|
168 |
|
169 |
<body>
|
170 |
+
<h1>Motion Capture Visualization</h1>
|
171 |
+
|
172 |
+
<div class="main-container">
|
173 |
+
<!-- Panel A: Episodes List -->
|
174 |
+
<div id="episodes-container">
|
175 |
+
<h3 id="episodes-title">Episodes</h3>
|
176 |
+
<div id="episodes-grid"></div>
|
177 |
+
</div>
|
178 |
+
|
179 |
+
<div class="content-container">
|
180 |
+
<!-- Panel B: Video Player -->
|
181 |
+
<div class="video-container">
|
182 |
+
<video id="laptopVideo">
|
183 |
+
<source src="https://huggingface.co/datasets/cyberorigin/fold_towels/resolve/main/Video/video.mp4"
|
184 |
+
type="video/mp4">
|
185 |
+
Your browser does not support the video tag.
|
186 |
+
</video>
|
187 |
+
<div class="controls">
|
188 |
+
<button id="playPauseBtn">▶️</button>
|
189 |
+
<button id="rewindBtn">⏪</button>
|
190 |
+
<button id="forwardBtn">⏩</button>
|
191 |
+
<button id="restartBtn">↩️</button>
|
192 |
+
</div>
|
193 |
+
<!-- Panel C: Plot Visualization -->
|
194 |
+
<div id="plotDiv"></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
</div>
|
196 |
+
</div>
|
197 |
+
</div>
|
198 |
+
|
199 |
+
<div id="loadingIndicator">Loading...</div>
|
200 |
+
|
201 |
+
<script>
|
202 |
+
let csvFilePath = 'https://huggingface.co/datasets/cyberorigin/fold_towels/resolve/main/MoCap/mocap.csv'
|
203 |
+
const body_part_names = [
|
204 |
+
'Left Shoulder', 'Right Upper Arm', 'Left Lower Leg', 'Spine1', 'Right Upper Leg',
|
205 |
+
'Spine3', 'Right Lower Arm', 'Left Foot', 'Right Lower Leg', 'Right Shoulder',
|
206 |
+
'Left Hand', 'Left Upper Leg', 'Right Foot', 'Spine', 'Spine2', 'Left Lower Arm',
|
207 |
+
'Left Toe', 'Neck', 'Right Hand', 'Right Toe', 'Head', 'Left Upper Arm', 'Hips',
|
208 |
+
]
|
209 |
+
const laptopVideo = document.getElementById('laptopVideo')
|
210 |
+
const playPauseBtn = document.getElementById('playPauseBtn')
|
211 |
+
const rewindBtn = document.getElementById('rewindBtn')
|
212 |
+
const forwardBtn = document.getElementById('forwardBtn')
|
213 |
+
const restartBtn = document.getElementById('restartBtn')
|
214 |
+
const radioButtons = document.querySelectorAll('input[name="videoOption"]')
|
215 |
+
const episodeContainer = document.getElementById('episodes-container')
|
216 |
+
const episodesGrid = document.getElementById('episodes-grid')
|
217 |
+
document.addEventListener('DOMContentLoaded', loadEpisodesCsv)
|
218 |
+
|
219 |
+
function loadEpisodesCsv() {
|
220 |
+
fetch('https://huggingface.co/datasets/cyberorigin/test/resolve/main/episodes.csv')
|
221 |
+
.then(response => response.text())
|
222 |
+
.then(data => {
|
223 |
+
const lines = data.split('\n')
|
224 |
+
processEpisodes(lines)
|
225 |
+
})
|
226 |
+
.catch(error => console.error('Error loading CSV file:', error))
|
227 |
+
}
|
228 |
+
|
229 |
+
function processEpisodes(lines) {
|
230 |
+
episodesGrid.innerHTML = ''
|
231 |
+
lines.forEach((line, index) => {
|
232 |
+
if (line.trim() !== '' && index != 0) {
|
233 |
+
const id = line.split(',')[0]
|
234 |
+
const episodeNumber = index
|
235 |
+
|
236 |
+
const radioDiv = document.createElement('div')
|
237 |
+
radioDiv.className = 'episode-radio'
|
238 |
+
|
239 |
+
const radio = document.createElement('input')
|
240 |
+
radio.type = 'radio'
|
241 |
+
radio.id = `episode${episodeNumber}`
|
242 |
+
radio.name = 'episodeGroup'
|
243 |
+
radio.addEventListener('change', () => updateVideoAndCSVSource(id))
|
244 |
+
|
245 |
+
const label = document.createElement('label')
|
246 |
+
label.htmlFor = `episode${episodeNumber}`
|
247 |
+
label.textContent = `Episode ${episodeNumber}`
|
248 |
+
|
249 |
+
radioDiv.appendChild(radio)
|
250 |
+
radioDiv.appendChild(label)
|
251 |
+
episodesGrid.appendChild(radioDiv)
|
252 |
+
}
|
253 |
+
})
|
254 |
+
}
|
255 |
+
|
256 |
+
|
257 |
+
let totalEpisodes = 100 //获取episode的数量
|
258 |
+
// const container = document.getElementById('episodes-container')
|
259 |
+
// 循环创建复选框
|
260 |
+
|
261 |
+
let animationFrameId
|
262 |
+
let isPlaying = false
|
263 |
+
|
264 |
+
function togglePlayPause() {
|
265 |
+
if (!isPlaying) {
|
266 |
+
laptopVideo.play()
|
267 |
+
playPauseBtn.textContent = '⏸️'
|
268 |
+
isPlaying = true
|
269 |
+
animate3DVisualization()
|
270 |
+
} else {
|
271 |
+
laptopVideo.pause()
|
272 |
+
playPauseBtn.textContent = '▶️'
|
273 |
+
isPlaying = false
|
274 |
+
cancelAnimationFrame(animationFrameId)
|
275 |
+
}
|
276 |
+
}
|
277 |
+
|
278 |
+
function rewind() {
|
279 |
+
laptopVideo.currentTime -= 5
|
280 |
+
update3DVisualization()
|
281 |
+
}
|
282 |
+
|
283 |
+
function forward() {
|
284 |
+
laptopVideo.currentTime += 5
|
285 |
+
update3DVisualization()
|
286 |
+
}
|
287 |
+
|
288 |
+
function restart() {
|
289 |
+
laptopVideo.currentTime = 0
|
290 |
+
update3DVisualization()
|
291 |
+
}
|
292 |
+
|
293 |
+
playPauseBtn.addEventListener('click', togglePlayPause)
|
294 |
+
rewindBtn.addEventListener('click', rewind)
|
295 |
+
forwardBtn.addEventListener('click', forward)
|
296 |
+
restartBtn.addEventListener('click', restart)
|
297 |
+
|
298 |
+
function getCoordinates(data, coordinate) {
|
299 |
+
return body_part_names.map(part => parseFloat(data[`${part}_${coordinate}`]))
|
300 |
+
}
|
301 |
+
|
302 |
+
let frames
|
303 |
+
|
304 |
+
function processData(results) {
|
305 |
+
console.log('Processing data:', results)
|
306 |
+
const motion_capture_data = results.data.filter((_, index) => index % 3 === 0)
|
307 |
+
frames = motion_capture_data.map((row, index) => ({
|
308 |
+
name: index.toString(),
|
309 |
+
data: [{
|
310 |
+
x: getCoordinates(row, 'x'),
|
311 |
+
y: getCoordinates(row, 'y'),
|
312 |
+
z: getCoordinates(row, 'z'),
|
313 |
+
mode: 'markers',
|
314 |
+
type: 'scatter3d',
|
315 |
+
marker: { size: 4.8, color: 'blue' },
|
316 |
+
}],
|
317 |
+
}))
|
318 |
+
if (frames.length === 0) {
|
319 |
+
console.error('No frames were created from the data')
|
320 |
+
return
|
321 |
+
}
|
322 |
+
const initialFrame = frames[0].data[0]
|
323 |
+
const layout = {
|
324 |
+
title: {
|
325 |
+
text: '3D Motion Capture',
|
326 |
+
font: {
|
327 |
+
color: 'white',
|
328 |
+
size: 20, // 设置字体大小
|
329 |
+
},
|
330 |
+
x: 0.5, // 设置标题在x轴的位置(0.5表示居中)
|
331 |
+
y: 1.2,
|
332 |
+
},
|
333 |
+
paper_bgcolor: 'black',
|
334 |
+
plot_bgcolor: 'black',
|
335 |
+
scene: {
|
336 |
+
xaxis: {
|
337 |
+
title: 'X',
|
338 |
+
color: 'white',
|
339 |
+
gridcolor: 'gray',
|
340 |
+
},
|
341 |
+
yaxis: {
|
342 |
+
title: 'Y',
|
343 |
+
color: 'white',
|
344 |
+
gridcolor: 'gray',
|
345 |
+
},
|
346 |
+
zaxis: {
|
347 |
+
title: 'Z',
|
348 |
+
color: 'white',
|
349 |
+
gridcolor: 'gray',
|
350 |
+
},
|
351 |
+
bgcolor: 'black',
|
352 |
+
},
|
353 |
+
font: { color: 'white' },
|
354 |
+
margin: {
|
355 |
+
l: 2, // 左边距
|
356 |
+
r: 2, // 右边距
|
357 |
+
b: 2, // 底部边距
|
358 |
+
t: 50, // 顶部边距
|
359 |
+
pad: 4, // 图表内边距
|
360 |
+
},
|
361 |
+
}
|
362 |
+
Plotly.newPlot('plotDiv', [initialFrame], layout)
|
363 |
+
}
|
364 |
+
|
365 |
+
function update3DVisualization() {
|
366 |
+
if (!frames) return
|
367 |
+
const currentTime = laptopVideo.currentTime
|
368 |
+
const totalDuration = laptopVideo.duration
|
369 |
+
const frameIndex = Math.floor((currentTime / totalDuration) * frames.length)
|
370 |
+
const frame = frames[Math.min(frameIndex, frames.length - 1)]
|
371 |
+
Plotly.animate('plotDiv', frame, {
|
372 |
+
transition: { duration: 0 },
|
373 |
+
frame: { duration: 0, redraw: true },
|
374 |
+
})
|
375 |
+
}
|
376 |
+
|
377 |
+
function animate3DVisualization() {
|
378 |
+
update3DVisualization()
|
379 |
+
if (isPlaying) {
|
380 |
+
animationFrameId = requestAnimationFrame(animate3DVisualization)
|
381 |
+
}
|
382 |
+
}
|
383 |
+
|
384 |
+
//function updateVideoAndCSVSource() {
|
385 |
+
//const selectedOption = document.querySelector('input[name="videoOption"]:checked').value;
|
386 |
+
//const videoUrl = `https://huggingface.co/datasets/cyberorigin/${selectedOption}/resolve/main/Video/video.mp4`;
|
387 |
+
//if (selectedOption != "twist_the_tube") {
|
388 |
+
// csvFilePath = `https://huggingface.co/datasets/cyberorigin/${selectedOption}/resolve/main/MoCap/mocap.csv`;
|
389 |
+
//}
|
390 |
+
//else {
|
391 |
+
// csvFilePath = `https://huggingface.co/datasets/cyberorigin/${selectedOption}/resolve/main/MoCap/MoCap.csv`;
|
392 |
+
//}
|
393 |
+
function updateVideoAndCSVSource(id) {
|
394 |
+
const selectedOption = document.querySelector('input[name="episodeGroup"]:checked').value
|
395 |
+
const videoUrl = `https://huggingface.co/datasets/cyberorigin/pick_and_place/resolve/main/color/${id}.mp4`
|
396 |
+
csvFilePath = `https://huggingface.co/datasets/cyberorigin/pick_and_place/resolve/main/motion_capture/${id}.csv`
|
397 |
+
|
398 |
+
laptopVideo.pause()
|
399 |
+
|
400 |
+
laptopVideo.querySelector('source').src = videoUrl
|
401 |
+
|
402 |
+
laptopVideo.load()
|
403 |
+
|
404 |
+
isPlaying = false
|
405 |
+
playPauseBtn.textContent = '▶️'
|
406 |
+
// Fetch and process the new CSV data
|
407 |
+
fetchAndProcessActionCSV()
|
408 |
+
}
|
409 |
+
|
410 |
+
function fetchAndProcessActionCSV() {
|
411 |
+
fetch(csvFilePath)
|
412 |
+
.then(response => {
|
413 |
+
if (!response.ok) {
|
414 |
+
throw new Error(`HTTP error! status: ${response.status}`)
|
415 |
+
}
|
416 |
+
return response.text()
|
417 |
+
})
|
418 |
+
.then(csvString => {
|
419 |
+
console.log('CSV data loaded successfully')
|
420 |
+
Papa.parse(csvString, {
|
421 |
+
header: true,
|
422 |
+
dynamicTyping: true,
|
423 |
+
complete: processData,
|
424 |
+
})
|
425 |
+
})
|
426 |
+
.catch(error => console.error('Error loading the CSV file:', error))
|
427 |
+
}
|
428 |
+
|
429 |
+
//radioButtons.forEach(radio => {
|
430 |
+
// radio.addEventListener('change', updateVideoAndCSVSource);
|
431 |
+
//});
|
432 |
+
// Initial CSV fetch and processing
|
433 |
+
fetchAndProcessActionCSV()
|
434 |
+
</script>
|
435 |
</body>
|
436 |
|
437 |
</html>
|