Skip to content

Commit

Permalink
correct
Browse files Browse the repository at this point in the history
  • Loading branch information
范丞德 committed Oct 18, 2024
1 parent 6e5b988 commit 03cb731
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions spectromotion/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -148,26 +148,26 @@ <h2 class="title is-4">Results and comparisons</h2>
const methods = ['NeRF-DS', 'Deformable 3DGS', '4DGS', 'GaussianShader', 'GS-IR', 'HyperNeRF'];
const views = ['RGB', 'Depth', 'Normal'];

let currentScene = scenes[0];
let currentMethod = methods[0];
let currentView = views[0];
let currentSceneIndex = 0;
let currentMethodIndex = 0;
let currentViewIndex = 0;

function createTabs(containerId, items, clickHandler) {
const container = document.getElementById(containerId);
items.forEach((item, index) => {
const li = document.createElement('li');
const a = document.createElement('a');
a.textContent = item;
a.onclick = () => clickHandler(item);
a.onclick = () => clickHandler(index);
li.appendChild(a);
container.appendChild(li);
});
}

function updateActiveTab(containerId, activeItem) {
function updateActiveTab(containerId, activeIndex) {
const tabs = document.querySelectorAll(`#${containerId} li`);
tabs.forEach(tab => {
tab.className = tab.textContent === activeItem ? 'is-active' : '';
tabs.forEach((tab, index) => {
tab.className = index === activeIndex ? 'is-active' : '';
});
}

Expand All @@ -177,7 +177,7 @@ <h2 class="title is-4">Results and comparisons</h2>

const videoComparison = document.createElement('div');
videoComparison.className = 'video-comparison';
videoComparison.setAttribute('data-label', currentMethod);
videoComparison.setAttribute('data-label', methods[currentMethodIndex]);
videoComparison.setAttribute('data-label2', 'Ours');

const video = document.createElement('video');
Expand All @@ -186,7 +186,7 @@ <h2 class="title is-4">Results and comparisons</h2>
video.loop = true;
video.playsinline = true;
video.muted = true;
video.src = `./static/videos/${currentMethod.toLowerCase()}_${currentScene}_ours_${currentScene}_${currentView.toLowerCase()}_30fps.mp4`;
video.src = `./static/videos/${methods[currentMethodIndex].toLowerCase()}_${scenes[currentSceneIndex]}_ours_${scenes[currentSceneIndex]}_${views[currentViewIndex].toLowerCase()}_30fps.mp4`;

const canvas = document.createElement('canvas');

Expand All @@ -195,21 +195,21 @@ <h2 class="title is-4">Results and comparisons</h2>
container.appendChild(videoComparison);
}

function switchScene(scene) {
currentScene = scene;
updateActiveTab('scene-tabs', scene);
function switchScene(index) {
currentSceneIndex = index;
updateActiveTab('scene-tabs', currentSceneIndex);
createVideoComparison();
}

function switchMethod(method) {
currentMethod = method;
updateActiveTab('method-tabs', method);
function switchMethod(index) {
currentMethodIndex = index;
updateActiveTab('method-tabs', currentMethodIndex);
createVideoComparison();
}

function switchView(view) {
currentView = view;
updateActiveTab('view-tabs', view);
function switchView(index) {
currentViewIndex = index;
updateActiveTab('view-tabs', currentViewIndex);
createVideoComparison();
}

Expand All @@ -219,9 +219,9 @@ <h2 class="title is-4">Results and comparisons</h2>
createTabs('view-tabs', views, switchView);

// Set initial active tabs
updateActiveTab('scene-tabs', currentScene);
updateActiveTab('method-tabs', currentMethod);
updateActiveTab('view-tabs', currentView);
updateActiveTab('scene-tabs', currentSceneIndex);
updateActiveTab('method-tabs', currentMethodIndex);
updateActiveTab('view-tabs', currentViewIndex);

// Create initial video comparison
createVideoComparison();
Expand Down

0 comments on commit 03cb731

Please sign in to comment.