Update index.html
Browse files- index.html +108 -48
index.html
CHANGED
@@ -8,9 +8,10 @@
|
|
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 |
<style>
|
12 |
body {
|
13 |
-
font-family:
|
14 |
margin: 0;
|
15 |
padding: 20px;
|
16 |
display: flex;
|
@@ -47,10 +48,11 @@
|
|
47 |
display: flex;
|
48 |
justify-content: space-between;
|
49 |
flex-grow: 1;
|
|
|
50 |
}
|
51 |
-
|
52 |
.video-container {
|
53 |
-
width:
|
54 |
}
|
55 |
|
56 |
#plotDiv {
|
@@ -59,12 +61,34 @@
|
|
59 |
}
|
60 |
|
61 |
#episodes-container {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
display: grid;
|
63 |
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
|
64 |
gap: 2px;
|
65 |
-
padding:
|
66 |
-
|
67 |
-
|
|
|
|
|
|
|
68 |
}
|
69 |
|
70 |
video {
|
@@ -77,8 +101,8 @@
|
|
77 |
justify-content: center;
|
78 |
margin-top: 2px;
|
79 |
}
|
80 |
-
|
81 |
-
button {
|
82 |
margin: 0 5px;
|
83 |
font-size: 20px;
|
84 |
background-color: #333;
|
@@ -92,7 +116,7 @@
|
|
92 |
display: block;
|
93 |
margin-bottom: 20px;
|
94 |
}
|
95 |
-
|
96 |
#loadingIndicator {
|
97 |
display: none;
|
98 |
position: fixed;
|
@@ -107,9 +131,12 @@
|
|
107 |
}
|
108 |
|
109 |
.checkbox-list {
|
110 |
-
max-height: 400px;
|
111 |
-
|
112 |
-
|
|
|
|
|
|
|
113 |
}
|
114 |
|
115 |
.checkbox-list label {
|
@@ -157,12 +184,11 @@
|
|
157 |
</div>
|
158 |
-->
|
159 |
<div id="episodes-container">
|
160 |
-
<h3>Episodes</h3>
|
161 |
-
<div
|
162 |
-
<!-- 复选框将在这里动态生成 -->
|
163 |
-
</div>
|
164 |
</div>
|
165 |
<div class="content-container">
|
|
|
166 |
<div class="checkbox-container">
|
167 |
<h3>Tasks</h3>
|
168 |
<label>
|
@@ -177,7 +203,7 @@
|
|
177 |
<label>
|
178 |
<input type="radio" name="videoOption" value="twist_the_tube"> Twist the tube
|
179 |
</label>
|
180 |
-
</div
|
181 |
|
182 |
<div class="video-container">
|
183 |
<video id="laptopVideo">
|
@@ -212,19 +238,50 @@
|
|
212 |
const forwardBtn = document.getElementById('forwardBtn');
|
213 |
const restartBtn = document.getElementById('restartBtn');
|
214 |
const radioButtons = document.querySelectorAll('input[name="videoOption"]');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
215 |
let totalEpisodes = 100; //获取episode的数量
|
216 |
// const container = document.getElementById('episodes-container')
|
217 |
// 循环创建复选框
|
218 |
-
|
219 |
-
for (let i = 1; i <= totalEpisodes; i++) {
|
220 |
-
const label = document.createElement('label');
|
221 |
-
const checkbox = document.createElement('input');
|
222 |
-
checkbox.type = 'checkbox';
|
223 |
-
checkbox.id = `episode-${i}`;
|
224 |
-
label.appendChild(checkbox);
|
225 |
-
label.appendChild(document.createTextNode(` Episode ${i}`));
|
226 |
-
container.appendChild(label);
|
227 |
-
}
|
228 |
let animationFrameId;
|
229 |
let isPlaying = false;
|
230 |
function togglePlayPause() {
|
@@ -282,27 +339,27 @@
|
|
282 |
const layout = {
|
283 |
title: {
|
284 |
text: '3D Motion Capture',
|
285 |
-
font: {
|
286 |
color: 'white',
|
287 |
size: 20 // 设置字体大小
|
288 |
},
|
289 |
x: 0.5, // 设置标题在x轴的位置(0.5表示居中)
|
290 |
-
y: 1
|
291 |
},
|
292 |
paper_bgcolor: 'black',
|
293 |
plot_bgcolor: 'black',
|
294 |
scene: {
|
295 |
-
xaxis: {
|
296 |
title: 'X',
|
297 |
color: 'white',
|
298 |
gridcolor: 'gray'
|
299 |
},
|
300 |
-
yaxis: {
|
301 |
title: 'Y',
|
302 |
color: 'white',
|
303 |
gridcolor: 'gray'
|
304 |
},
|
305 |
-
zaxis: {
|
306 |
title: 'Z',
|
307 |
color: 'white',
|
308 |
gridcolor: 'gray'
|
@@ -337,16 +394,19 @@
|
|
337 |
animationFrameId = requestAnimationFrame(animate3DVisualization);
|
338 |
}
|
339 |
}
|
340 |
-
function updateVideoAndCSVSource() {
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
|
|
|
|
|
|
350 |
|
351 |
laptopVideo.pause();
|
352 |
|
@@ -357,9 +417,9 @@
|
|
357 |
isPlaying = false;
|
358 |
playPauseBtn.textContent = '▶️';
|
359 |
// Fetch and process the new CSV data
|
360 |
-
|
361 |
}
|
362 |
-
function
|
363 |
fetch(csvFilePath)
|
364 |
.then(response => {
|
365 |
if (!response.ok) {
|
@@ -377,11 +437,11 @@
|
|
377 |
})
|
378 |
.catch(error => console.error('Error loading the CSV file:', error));
|
379 |
}
|
380 |
-
radioButtons.forEach(radio => {
|
381 |
-
|
382 |
-
});
|
383 |
// Initial CSV fetch and processing
|
384 |
-
|
385 |
</script>
|
386 |
</body>
|
387 |
|
|
|
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-->
|
12 |
<style>
|
13 |
body {
|
14 |
+
font-family: Arial, Helvetica, sans-serif;
|
15 |
margin: 0;
|
16 |
padding: 20px;
|
17 |
display: flex;
|
|
|
48 |
display: flex;
|
49 |
justify-content: space-between;
|
50 |
flex-grow: 1;
|
51 |
+
margin-left: 120px;
|
52 |
}
|
53 |
+
|
54 |
.video-container {
|
55 |
+
width: 58%;
|
56 |
}
|
57 |
|
58 |
#plotDiv {
|
|
|
61 |
}
|
62 |
|
63 |
#episodes-container {
|
64 |
+
max-height: 500px;
|
65 |
+
overflow-y: auto;
|
66 |
+
border: 1px solid #ccc;
|
67 |
+
border-radius: 5px;
|
68 |
+
background-color: #222;
|
69 |
+
margin-left: 50px;
|
70 |
+
}
|
71 |
+
|
72 |
+
#episodes-title {
|
73 |
+
background-color: #222;
|
74 |
+
color: #fff;
|
75 |
+
padding: 10px;
|
76 |
+
margin: 0;
|
77 |
+
position: sticky;
|
78 |
+
top: 0;
|
79 |
+
z-index: 1;
|
80 |
+
}
|
81 |
+
|
82 |
+
#episodes-grid {
|
83 |
display: grid;
|
84 |
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
|
85 |
gap: 2px;
|
86 |
+
padding: 10px;
|
87 |
+
}
|
88 |
+
|
89 |
+
.episode-radio {
|
90 |
+
display: flex;
|
91 |
+
align-items: center;
|
92 |
}
|
93 |
|
94 |
video {
|
|
|
101 |
justify-content: center;
|
102 |
margin-top: 2px;
|
103 |
}
|
104 |
+
|
105 |
+
· button {
|
106 |
margin: 0 5px;
|
107 |
font-size: 20px;
|
108 |
background-color: #333;
|
|
|
116 |
display: block;
|
117 |
margin-bottom: 20px;
|
118 |
}
|
119 |
+
|
120 |
#loadingIndicator {
|
121 |
display: none;
|
122 |
position: fixed;
|
|
|
131 |
}
|
132 |
|
133 |
.checkbox-list {
|
134 |
+
max-height: 400px;
|
135 |
+
/* 设置最大高度,超过此高度会出现滚动条 */
|
136 |
+
overflow-y: auto;
|
137 |
+
/* 添加垂直滚动条 */
|
138 |
+
padding-right: 10px;
|
139 |
+
/* 为滚动条留出空间 */
|
140 |
}
|
141 |
|
142 |
.checkbox-list label {
|
|
|
184 |
</div>
|
185 |
-->
|
186 |
<div id="episodes-container">
|
187 |
+
<h3 id="episodes-title">Episodes</h3>
|
188 |
+
<div id="episodes-grid"></div>
|
|
|
|
|
189 |
</div>
|
190 |
<div class="content-container">
|
191 |
+
<!--
|
192 |
<div class="checkbox-container">
|
193 |
<h3>Tasks</h3>
|
194 |
<label>
|
|
|
203 |
<label>
|
204 |
<input type="radio" name="videoOption" value="twist_the_tube"> Twist the tube
|
205 |
</label>
|
206 |
+
</div>-->
|
207 |
|
208 |
<div class="video-container">
|
209 |
<video id="laptopVideo">
|
|
|
238 |
const forwardBtn = document.getElementById('forwardBtn');
|
239 |
const restartBtn = document.getElementById('restartBtn');
|
240 |
const radioButtons = document.querySelectorAll('input[name="videoOption"]');
|
241 |
+
const episodeContainer = document.getElementById('episodes-container');
|
242 |
+
const episodesGrid = document.getElementById('episodes-grid');
|
243 |
+
document.addEventListener('DOMContentLoaded', loadEpisodesCsv);
|
244 |
+
function loadEpisodesCsv() {
|
245 |
+
fetch("https://huggingface.co/datasets/cyberorigin/test/resolve/main/episodes.csv")
|
246 |
+
.then(response => response.text())
|
247 |
+
.then(data => {
|
248 |
+
const lines = data.split('\n');
|
249 |
+
processEpisodes(lines);
|
250 |
+
})
|
251 |
+
.catch(error => console.error('Error loading CSV file:', error));
|
252 |
+
}
|
253 |
+
function processEpisodes(lines) {
|
254 |
+
episodesGrid.innerHTML = '';
|
255 |
+
lines.forEach((line, index) => {
|
256 |
+
if (line.trim() !== '' && index != 0) {
|
257 |
+
const id = line.split(',')[0];
|
258 |
+
const episodeNumber = index;
|
259 |
+
|
260 |
+
const radioDiv = document.createElement('div');
|
261 |
+
radioDiv.className = 'episode-radio';
|
262 |
+
|
263 |
+
const radio = document.createElement('input');
|
264 |
+
radio.type = 'radio';
|
265 |
+
radio.id = `episode${episodeNumber}`;
|
266 |
+
radio.name = 'episodeGroup';
|
267 |
+
radio.addEventListener('change', () => updateVideoAndCSVSource(id));
|
268 |
+
|
269 |
+
const label = document.createElement('label');
|
270 |
+
label.htmlFor = `episode${episodeNumber}`;
|
271 |
+
label.textContent = `Episode ${episodeNumber}`;
|
272 |
+
|
273 |
+
radioDiv.appendChild(radio);
|
274 |
+
radioDiv.appendChild(label);
|
275 |
+
episodesGrid.appendChild(radioDiv);
|
276 |
+
}
|
277 |
+
});
|
278 |
+
}
|
279 |
+
|
280 |
+
|
281 |
let totalEpisodes = 100; //获取episode的数量
|
282 |
// const container = document.getElementById('episodes-container')
|
283 |
// 循环创建复选框
|
284 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
285 |
let animationFrameId;
|
286 |
let isPlaying = false;
|
287 |
function togglePlayPause() {
|
|
|
339 |
const layout = {
|
340 |
title: {
|
341 |
text: '3D Motion Capture',
|
342 |
+
font: {
|
343 |
color: 'white',
|
344 |
size: 20 // 设置字体大小
|
345 |
},
|
346 |
x: 0.5, // 设置标题在x轴的位置(0.5表示居中)
|
347 |
+
y: 1.2
|
348 |
},
|
349 |
paper_bgcolor: 'black',
|
350 |
plot_bgcolor: 'black',
|
351 |
scene: {
|
352 |
+
xaxis: {
|
353 |
title: 'X',
|
354 |
color: 'white',
|
355 |
gridcolor: 'gray'
|
356 |
},
|
357 |
+
yaxis: {
|
358 |
title: 'Y',
|
359 |
color: 'white',
|
360 |
gridcolor: 'gray'
|
361 |
},
|
362 |
+
zaxis: {
|
363 |
title: 'Z',
|
364 |
color: 'white',
|
365 |
gridcolor: 'gray'
|
|
|
394 |
animationFrameId = requestAnimationFrame(animate3DVisualization);
|
395 |
}
|
396 |
}
|
397 |
+
//function updateVideoAndCSVSource() {
|
398 |
+
//const selectedOption = document.querySelector('input[name="videoOption"]:checked').value;
|
399 |
+
//const videoUrl = `https://huggingface.co/datasets/cyberorigin/${selectedOption}/resolve/main/Video/video.mp4`;
|
400 |
+
//if (selectedOption != "twist_the_tube") {
|
401 |
+
// csvFilePath = `https://huggingface.co/datasets/cyberorigin/${selectedOption}/resolve/main/MoCap/mocap.csv`;
|
402 |
+
//}
|
403 |
+
//else {
|
404 |
+
// csvFilePath = `https://huggingface.co/datasets/cyberorigin/${selectedOption}/resolve/main/MoCap/MoCap.csv`;
|
405 |
+
//}
|
406 |
+
function updateVideoAndCSVSource(id) {
|
407 |
+
const selectedOption = document.querySelector('input[name="episodeGroup"]:checked').value;
|
408 |
+
const videoUrl = `https://huggingface.co/datasets/cyberorigin/pick_and_place/resolve/main/color/${id}.mp4`;
|
409 |
+
csvFilePath = `https://huggingface.co/datasets/cyberorigin/pick_and_place/resolve/main/motion_capture/${id}.csv`;
|
410 |
|
411 |
laptopVideo.pause();
|
412 |
|
|
|
417 |
isPlaying = false;
|
418 |
playPauseBtn.textContent = '▶️';
|
419 |
// Fetch and process the new CSV data
|
420 |
+
fetchAndProcessActionCSV();
|
421 |
}
|
422 |
+
function fetchAndProcessActionCSV() {
|
423 |
fetch(csvFilePath)
|
424 |
.then(response => {
|
425 |
if (!response.ok) {
|
|
|
437 |
})
|
438 |
.catch(error => console.error('Error loading the CSV file:', error));
|
439 |
}
|
440 |
+
//radioButtons.forEach(radio => {
|
441 |
+
// radio.addEventListener('change', updateVideoAndCSVSource);
|
442 |
+
//});
|
443 |
// Initial CSV fetch and processing
|
444 |
+
fetchAndProcessActionCSV();
|
445 |
</script>
|
446 |
</body>
|
447 |
|