Spaces:
Running
Running
Commit
·
6098e79
1
Parent(s):
63eb12d
update index.html to include Google Fonts, enhance layout with tabs for video selection, and improve video source management based on selected tab.
Browse files- .gitattributes +1 -0
- MOB_NIGHT/FLIR.mp4 +3 -0
- MOB_NIGHT/SEA-AI-Brain.mp4 +3 -0
- FLIR.mp4 → SAILING_BOAT/FLIR.mp4 +0 -0
- SEA.AI-Brain.mp4 → SAILING_BOAT/SEA-AI-Brain.mp4 +0 -0
- index.html +66 -8
.gitattributes
CHANGED
@@ -37,3 +37,4 @@ flir_20240905_120243.mp4 filter=lfs diff=lfs merge=lfs -text
|
|
37 |
flir_brain_padded.mp4 filter=lfs diff=lfs merge=lfs -text
|
38 |
FLIR.mp4 filter=lfs diff=lfs merge=lfs -text
|
39 |
SEA.AI-Brain.mp4 filter=lfs diff=lfs merge=lfs -text
|
|
|
|
37 |
flir_brain_padded.mp4 filter=lfs diff=lfs merge=lfs -text
|
38 |
FLIR.mp4 filter=lfs diff=lfs merge=lfs -text
|
39 |
SEA.AI-Brain.mp4 filter=lfs diff=lfs merge=lfs -text
|
40 |
+
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
MOB_NIGHT/FLIR.mp4
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6d0507b737f7f7305d69c81a74720adc7f58f54dbb2c52501618aebe24698d97
|
3 |
+
size 15578650
|
MOB_NIGHT/SEA-AI-Brain.mp4
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8a7cf1e121ce1bfa8b5bf3257d6d4d15183099ec192d91c0062670b9694516e4
|
3 |
+
size 57576011
|
FLIR.mp4 → SAILING_BOAT/FLIR.mp4
RENAMED
File without changes
|
SEA.AI-Brain.mp4 → SAILING_BOAT/SEA-AI-Brain.mp4
RENAMED
File without changes
|
index.html
CHANGED
@@ -4,6 +4,7 @@
|
|
4 |
<meta charset="UTF-8">
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
<title>Video Comparison Slider</title>
|
|
|
7 |
<style>
|
8 |
:root {
|
9 |
--container-width: 80vw; /* Define a custom property for width */
|
@@ -12,10 +13,33 @@
|
|
12 |
margin: 0;
|
13 |
padding: 0;
|
14 |
display: flex;
|
|
|
15 |
justify-content: center;
|
16 |
align-items: center;
|
17 |
-
height: 100vh;
|
18 |
background-color: black;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
}
|
20 |
.video-container {
|
21 |
position: relative;
|
@@ -104,18 +128,57 @@
|
|
104 |
</style>
|
105 |
</head>
|
106 |
<body>
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
<div class="video-container" id="videoContainer">
|
108 |
-
<video id="video1"
|
109 |
-
<video id="video2" class="second-video"
|
110 |
<div class="slider" id="slider"></div>
|
111 |
</div>
|
112 |
|
113 |
<script>
|
114 |
const slider = document.getElementById('slider');
|
115 |
const container = document.getElementById('videoContainer');
|
|
|
116 |
const video2 = document.getElementById('video2');
|
|
|
117 |
let isDragging = false;
|
118 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
// Mouse events for slider
|
120 |
slider.addEventListener('mousedown', () => isDragging = true);
|
121 |
window.addEventListener('mouseup', () => isDragging = false);
|
@@ -136,13 +199,10 @@
|
|
136 |
const rect = container.getBoundingClientRect();
|
137 |
const offsetX = positionX - rect.left;
|
138 |
const sliderPosition = Math.max(0, Math.min(offsetX, rect.width));
|
139 |
-
// Move slider position
|
140 |
slider.style.left = `${sliderPosition}px`;
|
141 |
-
// Adjust second video visibility using clip-path
|
142 |
video2.style.clipPath = `inset(0 ${rect.width - sliderPosition}px 0 0)`;
|
143 |
}
|
144 |
|
145 |
-
// Function to update clip-path in real-time
|
146 |
function updateClipPath() {
|
147 |
const rect = container.getBoundingClientRect();
|
148 |
const sliderPosition = parseFloat(window.getComputedStyle(slider).left);
|
@@ -150,7 +210,6 @@
|
|
150 |
requestAnimationFrame(updateClipPath);
|
151 |
}
|
152 |
|
153 |
-
// Enable user control after the animation ends
|
154 |
slider.addEventListener('animationend', () => {
|
155 |
slider.classList.add('ready');
|
156 |
slider.style.animation = 'none';
|
@@ -158,7 +217,6 @@
|
|
158 |
slider.style.pointerEvents = 'auto';
|
159 |
});
|
160 |
|
161 |
-
// Start updating clip-path once the page loads
|
162 |
window.onload = () => updateClipPath();
|
163 |
</script>
|
164 |
</body>
|
|
|
4 |
<meta charset="UTF-8">
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
<title>Video Comparison Slider</title>
|
7 |
+
<link href="https://fonts.googleapis.com/css2?family=Saira:wght@400;500;600;700&display=swap" rel="stylesheet">
|
8 |
<style>
|
9 |
:root {
|
10 |
--container-width: 80vw; /* Define a custom property for width */
|
|
|
13 |
margin: 0;
|
14 |
padding: 0;
|
15 |
display: flex;
|
16 |
+
flex-direction: column;
|
17 |
justify-content: center;
|
18 |
align-items: center;
|
19 |
+
min-height: 100vh;
|
20 |
background-color: black;
|
21 |
+
color: white;
|
22 |
+
font-family: 'Saira', sans-serif;
|
23 |
+
}
|
24 |
+
.tabs {
|
25 |
+
display: flex;
|
26 |
+
gap: 10px;
|
27 |
+
margin-bottom: 20px;
|
28 |
+
}
|
29 |
+
.tab {
|
30 |
+
padding: 10px 20px;
|
31 |
+
background: rgba(255, 255, 255, 0.1);
|
32 |
+
border-radius: 5px;
|
33 |
+
cursor: pointer;
|
34 |
+
transition: background 0.3s;
|
35 |
+
font-weight: 500;
|
36 |
+
letter-spacing: 0.5px;
|
37 |
+
}
|
38 |
+
.tab:hover {
|
39 |
+
background: rgba(255, 255, 255, 0.2);
|
40 |
+
}
|
41 |
+
.tab.active {
|
42 |
+
background: rgb(0, 80, 150);
|
43 |
}
|
44 |
.video-container {
|
45 |
position: relative;
|
|
|
128 |
</style>
|
129 |
</head>
|
130 |
<body>
|
131 |
+
<div class="tabs" id="tabs">
|
132 |
+
<div class="tab" data-page="SAILING_BOAT">Sailing Boat</div>
|
133 |
+
<div class="tab" data-page="MOB_NIGHT">MOB Night</div>
|
134 |
+
<div class="tab" data-page="FAR_AWAY_OBJECT">Far Away Object</div>
|
135 |
+
<div class="tab" data-page="BUOYS">Buoys</div>
|
136 |
+
</div>
|
137 |
<div class="video-container" id="videoContainer">
|
138 |
+
<video id="video1" playsinline autoplay loop muted></video>
|
139 |
+
<video id="video2" class="second-video" playsinline autoplay loop muted></video>
|
140 |
<div class="slider" id="slider"></div>
|
141 |
</div>
|
142 |
|
143 |
<script>
|
144 |
const slider = document.getElementById('slider');
|
145 |
const container = document.getElementById('videoContainer');
|
146 |
+
const video1 = document.getElementById('video1');
|
147 |
const video2 = document.getElementById('video2');
|
148 |
+
const tabs = document.getElementById('tabs');
|
149 |
let isDragging = false;
|
150 |
|
151 |
+
// Get current page from URL or default to SAILING_BOAT
|
152 |
+
const urlParams = new URLSearchParams(window.location.search);
|
153 |
+
let currentPage = urlParams.get('page') || 'SAILING_BOAT';
|
154 |
+
|
155 |
+
// Function to update video sources
|
156 |
+
function updateVideos(page) {
|
157 |
+
video1.src = `${page}/SEA-AI-Brain.mp4`;
|
158 |
+
video2.src = `${page}/FLIR.mp4`;
|
159 |
+
currentPage = page;
|
160 |
+
|
161 |
+
// Update URL without reloading
|
162 |
+
const newUrl = new URL(window.location);
|
163 |
+
newUrl.searchParams.set('page', page);
|
164 |
+
window.history.pushState({}, '', newUrl);
|
165 |
+
|
166 |
+
// Update active tab
|
167 |
+
document.querySelectorAll('.tab').forEach(tab => {
|
168 |
+
tab.classList.toggle('active', tab.dataset.page === page);
|
169 |
+
});
|
170 |
+
}
|
171 |
+
|
172 |
+
// Tab click handlers
|
173 |
+
document.querySelectorAll('.tab').forEach(tab => {
|
174 |
+
tab.addEventListener('click', () => {
|
175 |
+
updateVideos(tab.dataset.page);
|
176 |
+
});
|
177 |
+
});
|
178 |
+
|
179 |
+
// Initialize with current page
|
180 |
+
updateVideos(currentPage);
|
181 |
+
|
182 |
// Mouse events for slider
|
183 |
slider.addEventListener('mousedown', () => isDragging = true);
|
184 |
window.addEventListener('mouseup', () => isDragging = false);
|
|
|
199 |
const rect = container.getBoundingClientRect();
|
200 |
const offsetX = positionX - rect.left;
|
201 |
const sliderPosition = Math.max(0, Math.min(offsetX, rect.width));
|
|
|
202 |
slider.style.left = `${sliderPosition}px`;
|
|
|
203 |
video2.style.clipPath = `inset(0 ${rect.width - sliderPosition}px 0 0)`;
|
204 |
}
|
205 |
|
|
|
206 |
function updateClipPath() {
|
207 |
const rect = container.getBoundingClientRect();
|
208 |
const sliderPosition = parseFloat(window.getComputedStyle(slider).left);
|
|
|
210 |
requestAnimationFrame(updateClipPath);
|
211 |
}
|
212 |
|
|
|
213 |
slider.addEventListener('animationend', () => {
|
214 |
slider.classList.add('ready');
|
215 |
slider.style.animation = 'none';
|
|
|
217 |
slider.style.pointerEvents = 'auto';
|
218 |
});
|
219 |
|
|
|
220 |
window.onload = () => updateClipPath();
|
221 |
</script>
|
222 |
</body>
|