kevinconka commited on
Commit
54fab46
·
verified ·
1 Parent(s): 507b04b

cursor simplification of html file

Browse files
Files changed (1) hide show
  1. index.html +118 -110
index.html CHANGED
@@ -1,5 +1,6 @@
1
  <!DOCTYPE html>
2
  <html lang="en">
 
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
@@ -7,70 +8,88 @@
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 */
 
 
11
  }
12
- body, html {
 
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;
46
- width: var(--container-width); /* Use the custom property for width */
47
- height: calc(var(--container-width) * 9 / 16); /* Calculate height based on width */
48
  overflow: hidden;
49
  }
 
50
  video {
51
  position: absolute;
52
- top: 0;
53
- left: 0;
54
  width: 100%;
55
  height: 100%;
56
  object-fit: cover;
57
  }
 
58
  .second-video {
59
  clip-path: inset(0 50% 0 0);
60
  }
 
 
61
  .slider {
62
  position: absolute;
63
  top: 0;
64
  left: 30%;
65
  width: 2px;
66
  height: 100%;
67
- background: rgb(0, 80, 150);
68
  cursor: ew-resize;
69
  z-index: 10;
70
- animation: slide-animation 5s ease-in-out forwards;
71
  border-radius: 4px;
72
- box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.2);
73
  }
 
74
  .slider::before,
75
  .slider::after {
76
  content: '';
@@ -81,185 +100,174 @@
81
  height: 30px;
82
  background-size: contain;
83
  background-repeat: no-repeat;
84
- transition: opacity 0.3s;
 
85
  }
 
86
  .slider::before {
87
  left: -27px;
88
- /* Simplified arrowhead pointing left */
89
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="rgb(0, 80, 150)"><polygon points="14,7 8,12 14,17"/></svg>');
90
  }
 
91
  .slider::after {
92
  right: -27px;
93
- /* Simplified arrowhead pointing right */
94
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="rgb(0, 80, 150)"><polygon points="10,7 16,12 10,17"/></svg>');
95
  }
96
- .slider.ready:hover::before,
97
- .slider.ready:hover::after {
98
- transform: translateY(-50%) scale(1.2);
99
- }
100
  .slider.ready::before,
101
  .slider.ready::after {
102
  opacity: 0.7;
103
  }
 
104
  .slider.ready:hover::before,
105
  .slider.ready:hover::after {
106
  opacity: 1;
 
107
  }
 
 
108
  .watermark {
109
  position: absolute;
110
- top: 1%;
111
  right: 1%;
112
  z-index: 15;
113
  opacity: 0;
114
  width: 12%;
115
  pointer-events: none;
116
- transition: opacity 0.3s ease;
117
- clip-path: inset(0 0 0 0);
118
  }
 
119
  .watermark img {
120
  width: 100%;
121
  height: auto;
122
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
123
  }
124
- @keyframes slide-animation {
 
 
125
  0% {
126
  left: 100%;
127
  }
 
128
  10% {
129
  left: 80%;
130
  }
 
131
  20% {
132
  left: 85%;
133
  }
 
134
  50% {
135
  left: 20%;
136
  }
 
137
  70% {
138
  left: 60%;
139
  }
 
140
  100% {
141
  left: 30%;
142
  }
143
  }
144
  </style>
145
  </head>
 
146
  <body>
147
- <div class="tabs" id="tabs">
148
  <div class="tab" data-page="SAILING_BOAT">Sailing Boat</div>
149
  <div class="tab" data-page="MOB_NIGHT">MOB Night</div>
150
  <div class="tab" data-page="BUOYS">Buoys</div>
151
- <!-- <div class="tab" data-page="FAR_AWAY_OBJECT">Far Away Object</div> -->
152
- </div>
153
- <div class="video-container" id="videoContainer">
154
  <video id="video1" playsinline autoplay loop muted></video>
155
  <video id="video2" class="second-video" playsinline autoplay loop muted></video>
156
  <div class="slider" id="slider"></div>
157
  <div class="watermark">
158
  <img src="Logo-SEA-AI.png" alt="SEA.AI Logo">
159
  </div>
160
- </div>
161
 
162
  <script>
163
- const slider = document.getElementById('slider');
164
- const container = document.getElementById('videoContainer');
165
- const video1 = document.getElementById('video1');
166
- const video2 = document.getElementById('video2');
167
- const tabs = document.getElementById('tabs');
168
- let isDragging = false;
 
 
169
 
170
- // Get current page from URL or default to SAILING_BOAT
171
- const urlParams = new URLSearchParams(window.location.search);
172
- let currentPage = urlParams.get('page') || 'SAILING_BOAT';
173
 
174
- // Function to update video sources
175
  function updateVideos(page) {
176
- video1.src = `${page}/SEA-AI-Brain.mp4`;
177
- video2.src = `${page}/FLIR.mp4`;
178
- currentPage = page;
179
-
180
- // Update URL without reloading
181
- const newUrl = new URL(window.location);
182
- newUrl.searchParams.set('page', page);
183
- window.history.pushState({}, '', newUrl);
184
-
185
- // Update active tab
186
  document.querySelectorAll('.tab').forEach(tab => {
187
  tab.classList.toggle('active', tab.dataset.page === page);
188
  });
189
  }
190
 
191
- // Tab click handlers
192
- document.querySelectorAll('.tab').forEach(tab => {
193
- tab.addEventListener('click', () => {
194
- updateVideos(tab.dataset.page);
195
- });
196
- });
197
-
198
- // Initialize with current page
199
- updateVideos(currentPage);
200
-
201
- // Mouse events for slider
202
- slider.addEventListener('mousedown', () => isDragging = true);
203
- window.addEventListener('mouseup', () => isDragging = false);
204
- window.addEventListener('mousemove', (event) => {
205
- if (!isDragging) return;
206
- handleSlide(event.clientX);
207
- });
208
 
209
- // Touch events for slider
210
- slider.addEventListener('touchstart', () => isDragging = true);
211
- window.addEventListener('touchend', () => isDragging = false);
212
- window.addEventListener('touchmove', (event) => {
213
- if (!isDragging) return;
214
- handleSlide(event.touches[0].clientX);
215
- });
216
 
217
- function handleSlide(positionX) {
218
- const rect = container.getBoundingClientRect();
219
- const offsetX = positionX - rect.left;
220
- const sliderPosition = Math.max(0, Math.min(offsetX, rect.width));
221
- slider.style.left = `${sliderPosition}px`;
222
- video2.style.clipPath = `inset(0 ${rect.width - sliderPosition}px 0 0)`;
223
-
224
- // Update watermark visibility - show when video1 area is visible
225
- const watermark = document.querySelector('.watermark');
226
- const watermarkRect = watermark.getBoundingClientRect();
227
- const watermarkLeft = watermarkRect.left - container.getBoundingClientRect().left;
228
-
229
- if (sliderPosition > watermarkLeft) {
230
- watermark.style.opacity = '0';
231
- } else {
232
- watermark.style.opacity = '0.9';
233
- }
234
  }
235
 
236
  function updateClipPath() {
237
- const rect = container.getBoundingClientRect();
238
- const sliderPosition = parseFloat(window.getComputedStyle(slider).left);
239
- video2.style.clipPath = `inset(0 ${rect.width - sliderPosition}px 0 0)`;
240
-
241
- // Update watermark visibility during animation
242
- const watermark = document.querySelector('.watermark');
243
- const watermarkRect = watermark.getBoundingClientRect();
244
- const watermarkLeft = watermarkRect.left - rect.left;
245
-
246
- if (sliderPosition > watermarkLeft) {
247
- watermark.style.opacity = '0';
248
- } else {
249
- watermark.style.opacity = '0.9';
250
- }
251
-
252
  requestAnimationFrame(updateClipPath);
253
  }
254
 
255
- slider.addEventListener('animationend', () => {
256
- slider.classList.add('ready');
257
- slider.style.animation = 'none';
258
- slider.style.cursor = 'ew-resize';
259
- slider.style.pointerEvents = 'auto';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
260
  });
261
 
262
- window.onload = () => updateClipPath();
 
 
263
  </script>
264
  </body>
 
265
  </html>
 
1
  <!DOCTYPE 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">
 
8
  <link href="https://fonts.googleapis.com/css2?family=Saira:wght@400;500;600;700&display=swap" rel="stylesheet">
9
  <style>
10
  :root {
11
+ --container-width: 80vw;
12
+ --primary-color: rgb(0, 80, 150);
13
+ --transition-speed: 0.3s;
14
  }
15
+
16
+ * {
17
  margin: 0;
18
  padding: 0;
19
+ box-sizing: border-box;
20
+ }
21
+
22
+ body {
23
  display: flex;
24
  flex-direction: column;
25
  justify-content: center;
26
  align-items: center;
27
  min-height: 100vh;
28
+ background: black;
29
  color: white;
30
  font-family: 'Saira', sans-serif;
31
  }
32
+
33
+ /* Navigation */
34
  .tabs {
35
  display: flex;
36
  gap: 10px;
37
  margin-bottom: 20px;
38
  }
39
+
40
  .tab {
41
  padding: 10px 20px;
42
  background: rgba(255, 255, 255, 0.1);
43
  border-radius: 5px;
44
  cursor: pointer;
45
+ transition: background var(--transition-speed);
46
  font-weight: 500;
47
  letter-spacing: 0.5px;
48
  }
49
+
50
  .tab:hover {
51
  background: rgba(255, 255, 255, 0.2);
52
  }
53
+
54
  .tab.active {
55
+ background: var(--primary-color);
56
  }
57
+
58
+ /* Video Container */
59
  .video-container {
60
  position: relative;
61
+ width: var(--container-width);
62
+ height: calc(var(--container-width) * 9 / 16);
63
  overflow: hidden;
64
  }
65
+
66
  video {
67
  position: absolute;
68
+ inset: 0;
 
69
  width: 100%;
70
  height: 100%;
71
  object-fit: cover;
72
  }
73
+
74
  .second-video {
75
  clip-path: inset(0 50% 0 0);
76
  }
77
+
78
+ /* Slider */
79
  .slider {
80
  position: absolute;
81
  top: 0;
82
  left: 30%;
83
  width: 2px;
84
  height: 100%;
85
+ background: var(--primary-color);
86
  cursor: ew-resize;
87
  z-index: 10;
88
+ animation: slide-demo 5s ease-in-out forwards;
89
  border-radius: 4px;
90
+ box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
91
  }
92
+
93
  .slider::before,
94
  .slider::after {
95
  content: '';
 
100
  height: 30px;
101
  background-size: contain;
102
  background-repeat: no-repeat;
103
+ transition: all var(--transition-speed);
104
+ opacity: 0;
105
  }
106
+
107
  .slider::before {
108
  left: -27px;
 
109
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="rgb(0, 80, 150)"><polygon points="14,7 8,12 14,17"/></svg>');
110
  }
111
+
112
  .slider::after {
113
  right: -27px;
 
114
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="rgb(0, 80, 150)"><polygon points="10,7 16,12 10,17"/></svg>');
115
  }
116
+
 
 
 
117
  .slider.ready::before,
118
  .slider.ready::after {
119
  opacity: 0.7;
120
  }
121
+
122
  .slider.ready:hover::before,
123
  .slider.ready:hover::after {
124
  opacity: 1;
125
+ transform: translateY(-50%) scale(1.2);
126
  }
127
+
128
+ /* Watermark */
129
  .watermark {
130
  position: absolute;
131
+ top: 2%;
132
  right: 1%;
133
  z-index: 15;
134
  opacity: 0;
135
  width: 12%;
136
  pointer-events: none;
137
+ transition: opacity var(--transition-speed) ease;
 
138
  }
139
+
140
  .watermark img {
141
  width: 100%;
142
  height: auto;
143
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
144
  }
145
+
146
+ /* Animation */
147
+ @keyframes slide-demo {
148
  0% {
149
  left: 100%;
150
  }
151
+
152
  10% {
153
  left: 80%;
154
  }
155
+
156
  20% {
157
  left: 85%;
158
  }
159
+
160
  50% {
161
  left: 20%;
162
  }
163
+
164
  70% {
165
  left: 60%;
166
  }
167
+
168
  100% {
169
  left: 30%;
170
  }
171
  }
172
  </style>
173
  </head>
174
+
175
  <body>
176
+ <nav class="tabs" id="tabs">
177
  <div class="tab" data-page="SAILING_BOAT">Sailing Boat</div>
178
  <div class="tab" data-page="MOB_NIGHT">MOB Night</div>
179
  <div class="tab" data-page="BUOYS">Buoys</div>
180
+ </nav>
181
+
182
+ <main class="video-container" id="videoContainer">
183
  <video id="video1" playsinline autoplay loop muted></video>
184
  <video id="video2" class="second-video" playsinline autoplay loop muted></video>
185
  <div class="slider" id="slider"></div>
186
  <div class="watermark">
187
  <img src="Logo-SEA-AI.png" alt="SEA.AI Logo">
188
  </div>
189
+ </main>
190
 
191
  <script>
192
+ // DOM Elements
193
+ const elements = {
194
+ slider: document.getElementById('slider'),
195
+ container: document.getElementById('videoContainer'),
196
+ video1: document.getElementById('video1'),
197
+ video2: document.getElementById('video2'),
198
+ watermark: document.querySelector('.watermark')
199
+ };
200
 
201
+ // State
202
+ let isDragging = false;
203
+ const currentPage = new URLSearchParams(window.location.search).get('page') || 'SAILING_BOAT';
204
 
205
+ // Video Management
206
  function updateVideos(page) {
207
+ elements.video1.src = `${page}/SEA-AI-Brain.mp4`;
208
+ elements.video2.src = `${page}/FLIR.mp4`;
209
+
210
+ // Update URL and active tab
211
+ const url = new URL(window.location);
212
+ url.searchParams.set('page', page);
213
+ window.history.pushState({}, '', url);
214
+
 
 
215
  document.querySelectorAll('.tab').forEach(tab => {
216
  tab.classList.toggle('active', tab.dataset.page === page);
217
  });
218
  }
219
 
220
+ // Slider Logic
221
+ function handleSlide(positionX) {
222
+ const rect = elements.container.getBoundingClientRect();
223
+ const sliderPosition = Math.max(0, Math.min(positionX - rect.left, rect.width));
 
 
 
 
 
 
 
 
 
 
 
 
 
224
 
225
+ elements.slider.style.left = `${sliderPosition}px`;
226
+ elements.video2.style.clipPath = `inset(0 ${rect.width - sliderPosition}px 0 0)`;
 
 
 
 
 
227
 
228
+ // Update watermark visibility
229
+ const watermarkLeft = elements.watermark.getBoundingClientRect().left - rect.left;
230
+ elements.watermark.style.opacity = sliderPosition > watermarkLeft ? '0' : '0.9';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
231
  }
232
 
233
  function updateClipPath() {
234
+ const rect = elements.container.getBoundingClientRect();
235
+ const sliderPosition = parseFloat(window.getComputedStyle(elements.slider).left);
236
+
237
+ elements.video2.style.clipPath = `inset(0 ${rect.width - sliderPosition}px 0 0)`;
238
+
239
+ // Update watermark during animation
240
+ const watermarkLeft = elements.watermark.getBoundingClientRect().left - rect.left;
241
+ elements.watermark.style.opacity = sliderPosition > watermarkLeft ? '0' : '0.9';
242
+
 
 
 
 
 
 
243
  requestAnimationFrame(updateClipPath);
244
  }
245
 
246
+ // Event Listeners
247
+ document.querySelectorAll('.tab').forEach(tab => {
248
+ tab.addEventListener('click', () => updateVideos(tab.dataset.page));
249
+ });
250
+
251
+ // Mouse events
252
+ elements.slider.addEventListener('mousedown', () => isDragging = true);
253
+ window.addEventListener('mouseup', () => isDragging = false);
254
+ window.addEventListener('mousemove', e => isDragging && handleSlide(e.clientX));
255
+
256
+ // Touch events
257
+ elements.slider.addEventListener('touchstart', () => isDragging = true);
258
+ window.addEventListener('touchend', () => isDragging = false);
259
+ window.addEventListener('touchmove', e => isDragging && handleSlide(e.touches[0].clientX));
260
+
261
+ // Animation end
262
+ elements.slider.addEventListener('animationend', () => {
263
+ elements.slider.classList.add('ready');
264
+ elements.slider.style.animation = 'none';
265
  });
266
 
267
+ // Initialize
268
+ updateVideos(currentPage);
269
+ window.addEventListener('load', updateClipPath);
270
  </script>
271
  </body>
272
+
273
  </html>