Spaces:
Running
Running
Update index.html
Browse files- index.html +149 -100
index.html
CHANGED
|
@@ -15,11 +15,11 @@
|
|
| 15 |
|
| 16 |
<style>
|
| 17 |
:root {
|
| 18 |
-
--bg-color: #050505;
|
| 19 |
--text-color: #e0e0e0;
|
| 20 |
--text-color-muted: #777;
|
| 21 |
-
--accent-color: #00ffff; /* Cyan
|
| 22 |
-
--glow-color: rgba(0, 255, 255, 0.15);
|
| 23 |
--hover-bg: rgba(0, 255, 255, 0.1);
|
| 24 |
--border-color: rgba(255, 255, 255, 0.1);
|
| 25 |
--font-main: 'DM Sans', sans-serif;
|
|
@@ -33,7 +33,7 @@
|
|
| 33 |
}
|
| 34 |
|
| 35 |
html {
|
| 36 |
-
font-size: 16px;
|
| 37 |
}
|
| 38 |
|
| 39 |
body {
|
|
@@ -47,9 +47,9 @@
|
|
| 47 |
min-height: 100vh;
|
| 48 |
text-align: center;
|
| 49 |
position: relative;
|
| 50 |
-
overflow: hidden;
|
| 51 |
cursor: none; /* Hide default cursor */
|
| 52 |
-
perspective: 1000px;
|
| 53 |
}
|
| 54 |
|
| 55 |
/* Subtle Animated Background Gradient */
|
|
@@ -76,12 +76,11 @@
|
|
| 76 |
100% { transform: scale(1.1); opacity: 0.8; }
|
| 77 |
}
|
| 78 |
|
| 79 |
-
|
| 80 |
.container {
|
| 81 |
position: relative;
|
| 82 |
-
z-index: 2;
|
| 83 |
padding: 2rem;
|
| 84 |
-
max-width: 900px;
|
| 85 |
width: 90%;
|
| 86 |
animation: slideInUp 1s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.5s forwards;
|
| 87 |
opacity: 0;
|
|
@@ -96,19 +95,18 @@
|
|
| 96 |
}
|
| 97 |
|
| 98 |
h1 {
|
| 99 |
-
font-size: clamp(3rem, 10vw, 6rem);
|
| 100 |
-
font-weight: 700;
|
| 101 |
-
letter-spacing: -0.05em;
|
| 102 |
margin-bottom: 0.2rem;
|
| 103 |
color: var(--text-color);
|
| 104 |
text-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
|
| 105 |
transition: color var(--transition-speed) ease, text-shadow var(--transition-speed) ease;
|
| 106 |
-
position: relative; /* For potential pseudo-elements */
|
| 107 |
}
|
| 108 |
|
| 109 |
.subtitle {
|
| 110 |
font-size: clamp(0.9rem, 2.5vw, 1.2rem);
|
| 111 |
-
font-weight: 400;
|
| 112 |
color: var(--text-color-muted);
|
| 113 |
margin-bottom: 2.5rem;
|
| 114 |
letter-spacing: 0.05em;
|
|
@@ -135,7 +133,7 @@
|
|
| 135 |
display: flex;
|
| 136 |
flex-wrap: wrap;
|
| 137 |
justify-content: center;
|
| 138 |
-
gap: 0.8rem;
|
| 139 |
}
|
| 140 |
|
| 141 |
.model-badge {
|
|
@@ -145,17 +143,17 @@
|
|
| 145 |
font-size: clamp(0.75rem, 2vw, 0.9rem);
|
| 146 |
font-weight: 400;
|
| 147 |
padding: 0.5em 1em;
|
| 148 |
-
border-radius: 15px;
|
| 149 |
border: 1px solid var(--border-color);
|
| 150 |
transition: all var(--transition-speed) cubic-bezier(0.25, 0.46, 0.45, 0.94);
|
| 151 |
-
transform: scale(1);
|
| 152 |
}
|
| 153 |
|
| 154 |
.model-badge:hover {
|
| 155 |
background-color: var(--hover-bg);
|
| 156 |
color: var(--accent-color);
|
| 157 |
border-color: var(--accent-color);
|
| 158 |
-
transform: scale(1.05) translateY(-2px);
|
| 159 |
box-shadow: 0 4px 15px rgba(0, 255, 255, 0.2);
|
| 160 |
}
|
| 161 |
|
|
@@ -181,12 +179,12 @@
|
|
| 181 |
color: var(--text-color);
|
| 182 |
text-decoration: none;
|
| 183 |
font-size: clamp(0.9rem, 2.5vw, 1.1rem);
|
| 184 |
-
font-weight: 700;
|
| 185 |
padding: 0.8em 1.8em;
|
| 186 |
border: 2px solid var(--border-color);
|
| 187 |
border-radius: 5px;
|
| 188 |
position: relative;
|
| 189 |
-
overflow: hidden;
|
| 190 |
transition: all var(--transition-speed) ease;
|
| 191 |
z-index: 1;
|
| 192 |
}
|
|
@@ -204,22 +202,22 @@
|
|
| 204 |
}
|
| 205 |
|
| 206 |
.playground-link:hover {
|
| 207 |
-
color: var(--bg-color);
|
| 208 |
border-color: var(--accent-color);
|
| 209 |
-
transform: translateY(-3px);
|
| 210 |
box-shadow: 0 5px 20px rgba(0, 255, 255, 0.3);
|
| 211 |
}
|
| 212 |
|
| 213 |
.playground-link:hover::before {
|
| 214 |
-
left: 0;
|
| 215 |
}
|
| 216 |
|
| 217 |
-
.playground-link span {
|
| 218 |
display: inline-block;
|
| 219 |
transition: transform 0.2s ease;
|
| 220 |
}
|
| 221 |
.playground-link:hover span {
|
| 222 |
-
transform: translateX(3px);
|
| 223 |
}
|
| 224 |
|
| 225 |
|
|
@@ -227,59 +225,59 @@
|
|
| 227 |
|
| 228 |
.glow {
|
| 229 |
position: fixed;
|
| 230 |
-
|
|
|
|
|
|
|
|
|
|
| 231 |
height: 800px;
|
| 232 |
background: radial-gradient(circle at center, var(--glow-color) 0%, rgba(0, 0, 0, 0) 60%);
|
|
|
|
| 233 |
pointer-events: none;
|
| 234 |
opacity: 0;
|
| 235 |
-
transition: opacity 0.4s ease
|
| 236 |
-
transform: translate(-50%, -50%)
|
| 237 |
-
z-index: 1;
|
| 238 |
-
filter: blur(10px);
|
|
|
|
| 239 |
}
|
| 240 |
|
| 241 |
body:hover .glow {
|
| 242 |
opacity: 1;
|
| 243 |
-
transform: translate(-50%, -50%) scale(1);
|
| 244 |
}
|
| 245 |
|
| 246 |
.cursor {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 247 |
width: 25px;
|
| 248 |
height: 25px;
|
| 249 |
-
border: 2px solid var(--accent-color);
|
| 250 |
border-radius: 50%;
|
| 251 |
-
position: fixed;
|
| 252 |
pointer-events: none;
|
| 253 |
-
transition:
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
height 0.2s ease;
|
| 258 |
-
z-index: 9999; /* Always on top */
|
| 259 |
-
transform: translate(-50%, -50%);
|
| 260 |
-
mix-blend-mode: difference; /* Cool effect over elements */
|
| 261 |
background-color: transparent;
|
|
|
|
| 262 |
}
|
| 263 |
|
| 264 |
-
|
| 265 |
-
/* Handled by JS interactions */
|
| 266 |
-
}
|
| 267 |
-
|
| 268 |
-
/* Cursor interaction states */
|
| 269 |
.cursor.hover-link {
|
| 270 |
-
|
| 271 |
background-color: var(--accent-color);
|
| 272 |
border-color: transparent;
|
| 273 |
}
|
| 274 |
|
| 275 |
.cursor.hover-text {
|
| 276 |
-
|
| 277 |
border-width: 4px;
|
| 278 |
border-color: rgba(255,255,255, 0.5);
|
| 279 |
}
|
| 280 |
|
| 281 |
.cursor.clicking {
|
| 282 |
-
|
| 283 |
background-color: rgba(255,255,255,0.3);
|
| 284 |
}
|
| 285 |
|
|
@@ -304,6 +302,11 @@
|
|
| 304 |
.playground-link {
|
| 305 |
padding: 0.7em 1.5em;
|
| 306 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 307 |
}
|
| 308 |
|
| 309 |
</style>
|
|
@@ -321,13 +324,15 @@
|
|
| 321 |
<div class="models-section">
|
| 322 |
<h2>Free Access To Premium Models</h2>
|
| 323 |
<div class="models-grid">
|
| 324 |
-
<!--
|
| 325 |
<span class="model-badge">GPT-4o</span>
|
| 326 |
<span class="model-badge">GPT-4o-mini</span>
|
| 327 |
-
<span class="model-badge">
|
| 328 |
-
<span class="model-badge">
|
| 329 |
-
<span class="model-badge">GPT-4.5
|
| 330 |
<span class="model-badge">Claude 3.7 Sonnet</span>
|
|
|
|
|
|
|
| 331 |
<span class="model-badge">And More Top Models...</span>
|
| 332 |
</div>
|
| 333 |
</div>
|
|
@@ -346,7 +351,7 @@
|
|
| 346 |
const cursor = document.querySelector('.cursor');
|
| 347 |
const glow = document.querySelector('.glow');
|
| 348 |
const hoverables = document.querySelectorAll('a, .model-badge');
|
| 349 |
-
const textElements = document.querySelectorAll('h1, p, h2'); //
|
| 350 |
|
| 351 |
let mouseX = 0;
|
| 352 |
let mouseY = 0;
|
|
@@ -354,18 +359,50 @@
|
|
| 354 |
let cursorY = 0;
|
| 355 |
let glowX = 0;
|
| 356 |
let glowY = 0;
|
| 357 |
-
|
| 358 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 359 |
|
| 360 |
function animate() {
|
| 361 |
-
// Lerp
|
| 362 |
-
cursorX += (mouseX - cursorX) *
|
| 363 |
-
cursorY += (mouseY - cursorY) *
|
| 364 |
glowX += (mouseX - glowX) * glowSpeed;
|
| 365 |
glowY += (mouseY - glowY) * glowSpeed;
|
| 366 |
|
| 367 |
-
|
| 368 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 369 |
|
| 370 |
requestAnimationFrame(animate);
|
| 371 |
}
|
|
@@ -373,63 +410,75 @@
|
|
| 373 |
document.addEventListener('mousemove', (e) => {
|
| 374 |
mouseX = e.clientX;
|
| 375 |
mouseY = e.clientY;
|
| 376 |
-
|
| 377 |
-
// Move glow immediately for responsiveness on hover-in, smooth following otherwise
|
| 378 |
-
if (glow.style.opacity === '0') {
|
| 379 |
-
glow.style.left = mouseX + 'px';
|
| 380 |
-
glow.style.top = mouseY + 'px';
|
| 381 |
-
}
|
| 382 |
});
|
| 383 |
|
| 384 |
// Start the animation loop
|
| 385 |
animate();
|
| 386 |
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
|
| 390 |
-
|
| 391 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 392 |
});
|
| 393 |
-
el.addEventListener('mouseleave', () => {
|
| 394 |
-
cursor.classList.remove('hover-link');
|
| 395 |
-
cursor.dataset.scale = 'scale(1)'; // Reset scale
|
| 396 |
-
});
|
| 397 |
-
});
|
| 398 |
|
| 399 |
-
|
| 400 |
-
|
| 401 |
-
if (!
|
| 402 |
-
|
| 403 |
-
|
|
|
|
|
|
|
| 404 |
}
|
| 405 |
-
|
| 406 |
-
|
| 407 |
-
|
| 408 |
-
|
| 409 |
-
|
| 410 |
-
|
| 411 |
-
|
| 412 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 413 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 414 |
|
| 415 |
-
//
|
|
|
|
|
|
|
|
|
|
|
|
|
| 416 |
document.addEventListener('mousedown', () => {
|
| 417 |
cursor.classList.add('clicking');
|
| 418 |
-
|
| 419 |
});
|
| 420 |
|
| 421 |
document.addEventListener('mouseup', () => {
|
| 422 |
cursor.classList.remove('clicking');
|
| 423 |
-
//
|
| 424 |
-
if (cursor.classList.contains('hover-link')) {
|
| 425 |
-
cursor.dataset.scale = 'scale(1.5)';
|
| 426 |
-
} else if (cursor.classList.contains('hover-text')) {
|
| 427 |
-
cursor.dataset.scale = 'scale(0.7)';
|
| 428 |
-
} else {
|
| 429 |
-
cursor.dataset.scale = 'scale(1)';
|
| 430 |
-
}
|
| 431 |
});
|
| 432 |
|
|
|
|
|
|
|
|
|
|
| 433 |
</script>
|
| 434 |
</body>
|
| 435 |
</html>
|
|
|
|
| 15 |
|
| 16 |
<style>
|
| 17 |
:root {
|
| 18 |
+
--bg-color: #050505;
|
| 19 |
--text-color: #e0e0e0;
|
| 20 |
--text-color-muted: #777;
|
| 21 |
+
--accent-color: #00ffff; /* Cyan */
|
| 22 |
+
--glow-color: rgba(0, 255, 255, 0.15);
|
| 23 |
--hover-bg: rgba(0, 255, 255, 0.1);
|
| 24 |
--border-color: rgba(255, 255, 255, 0.1);
|
| 25 |
--font-main: 'DM Sans', sans-serif;
|
|
|
|
| 33 |
}
|
| 34 |
|
| 35 |
html {
|
| 36 |
+
font-size: 16px;
|
| 37 |
}
|
| 38 |
|
| 39 |
body {
|
|
|
|
| 47 |
min-height: 100vh;
|
| 48 |
text-align: center;
|
| 49 |
position: relative;
|
| 50 |
+
overflow: hidden;
|
| 51 |
cursor: none; /* Hide default cursor */
|
| 52 |
+
perspective: 1000px;
|
| 53 |
}
|
| 54 |
|
| 55 |
/* Subtle Animated Background Gradient */
|
|
|
|
| 76 |
100% { transform: scale(1.1); opacity: 0.8; }
|
| 77 |
}
|
| 78 |
|
|
|
|
| 79 |
.container {
|
| 80 |
position: relative;
|
| 81 |
+
z-index: 2;
|
| 82 |
padding: 2rem;
|
| 83 |
+
max-width: 900px;
|
| 84 |
width: 90%;
|
| 85 |
animation: slideInUp 1s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.5s forwards;
|
| 86 |
opacity: 0;
|
|
|
|
| 95 |
}
|
| 96 |
|
| 97 |
h1 {
|
| 98 |
+
font-size: clamp(3rem, 10vw, 6rem);
|
| 99 |
+
font-weight: 700;
|
| 100 |
+
letter-spacing: -0.05em;
|
| 101 |
margin-bottom: 0.2rem;
|
| 102 |
color: var(--text-color);
|
| 103 |
text-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
|
| 104 |
transition: color var(--transition-speed) ease, text-shadow var(--transition-speed) ease;
|
|
|
|
| 105 |
}
|
| 106 |
|
| 107 |
.subtitle {
|
| 108 |
font-size: clamp(0.9rem, 2.5vw, 1.2rem);
|
| 109 |
+
font-weight: 400;
|
| 110 |
color: var(--text-color-muted);
|
| 111 |
margin-bottom: 2.5rem;
|
| 112 |
letter-spacing: 0.05em;
|
|
|
|
| 133 |
display: flex;
|
| 134 |
flex-wrap: wrap;
|
| 135 |
justify-content: center;
|
| 136 |
+
gap: 0.8rem;
|
| 137 |
}
|
| 138 |
|
| 139 |
.model-badge {
|
|
|
|
| 143 |
font-size: clamp(0.75rem, 2vw, 0.9rem);
|
| 144 |
font-weight: 400;
|
| 145 |
padding: 0.5em 1em;
|
| 146 |
+
border-radius: 15px;
|
| 147 |
border: 1px solid var(--border-color);
|
| 148 |
transition: all var(--transition-speed) cubic-bezier(0.25, 0.46, 0.45, 0.94);
|
| 149 |
+
transform: scale(1);
|
| 150 |
}
|
| 151 |
|
| 152 |
.model-badge:hover {
|
| 153 |
background-color: var(--hover-bg);
|
| 154 |
color: var(--accent-color);
|
| 155 |
border-color: var(--accent-color);
|
| 156 |
+
transform: scale(1.05) translateY(-2px);
|
| 157 |
box-shadow: 0 4px 15px rgba(0, 255, 255, 0.2);
|
| 158 |
}
|
| 159 |
|
|
|
|
| 179 |
color: var(--text-color);
|
| 180 |
text-decoration: none;
|
| 181 |
font-size: clamp(0.9rem, 2.5vw, 1.1rem);
|
| 182 |
+
font-weight: 700;
|
| 183 |
padding: 0.8em 1.8em;
|
| 184 |
border: 2px solid var(--border-color);
|
| 185 |
border-radius: 5px;
|
| 186 |
position: relative;
|
| 187 |
+
overflow: hidden;
|
| 188 |
transition: all var(--transition-speed) ease;
|
| 189 |
z-index: 1;
|
| 190 |
}
|
|
|
|
| 202 |
}
|
| 203 |
|
| 204 |
.playground-link:hover {
|
| 205 |
+
color: var(--bg-color);
|
| 206 |
border-color: var(--accent-color);
|
| 207 |
+
transform: translateY(-3px);
|
| 208 |
box-shadow: 0 5px 20px rgba(0, 255, 255, 0.3);
|
| 209 |
}
|
| 210 |
|
| 211 |
.playground-link:hover::before {
|
| 212 |
+
left: 0;
|
| 213 |
}
|
| 214 |
|
| 215 |
+
.playground-link span {
|
| 216 |
display: inline-block;
|
| 217 |
transition: transform 0.2s ease;
|
| 218 |
}
|
| 219 |
.playground-link:hover span {
|
| 220 |
+
transform: translateX(3px);
|
| 221 |
}
|
| 222 |
|
| 223 |
|
|
|
|
| 225 |
|
| 226 |
.glow {
|
| 227 |
position: fixed;
|
| 228 |
+
/* Position set by JS */
|
| 229 |
+
left: 0;
|
| 230 |
+
top: 0;
|
| 231 |
+
width: 800px;
|
| 232 |
height: 800px;
|
| 233 |
background: radial-gradient(circle at center, var(--glow-color) 0%, rgba(0, 0, 0, 0) 60%);
|
| 234 |
+
border-radius: 50%; /* Ensure it's circular for centering */
|
| 235 |
pointer-events: none;
|
| 236 |
opacity: 0;
|
| 237 |
+
transition: opacity 0.4s ease; /* Only transition opacity */
|
| 238 |
+
/* transform: translate(-50%, -50%); NO - JS handles transform */
|
| 239 |
+
z-index: 1;
|
| 240 |
+
filter: blur(10px);
|
| 241 |
+
will-change: transform, opacity; /* Optimize animation */
|
| 242 |
}
|
| 243 |
|
| 244 |
body:hover .glow {
|
| 245 |
opacity: 1;
|
|
|
|
| 246 |
}
|
| 247 |
|
| 248 |
.cursor {
|
| 249 |
+
position: fixed;
|
| 250 |
+
/* Position set by JS */
|
| 251 |
+
left: 0;
|
| 252 |
+
top: 0;
|
| 253 |
width: 25px;
|
| 254 |
height: 25px;
|
| 255 |
+
border: 2px solid var(--accent-color);
|
| 256 |
border-radius: 50%;
|
|
|
|
| 257 |
pointer-events: none;
|
| 258 |
+
transition: background-color 0.2s ease, border-color 0.2s ease, border-width 0.2s ease, width 0.2s ease, height 0.2s ease; /* Smooth style changes, transform handled by JS loop */
|
| 259 |
+
/* transform: translate(-50%, -50%); NO - JS handles transform */
|
| 260 |
+
z-index: 9999;
|
| 261 |
+
mix-blend-mode: difference;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 262 |
background-color: transparent;
|
| 263 |
+
will-change: transform; /* Optimize animation */
|
| 264 |
}
|
| 265 |
|
| 266 |
+
/* Cursor interaction states (applied via JS) */
|
|
|
|
|
|
|
|
|
|
|
|
|
| 267 |
.cursor.hover-link {
|
| 268 |
+
/* Scale handled by JS */
|
| 269 |
background-color: var(--accent-color);
|
| 270 |
border-color: transparent;
|
| 271 |
}
|
| 272 |
|
| 273 |
.cursor.hover-text {
|
| 274 |
+
/* Scale handled by JS */
|
| 275 |
border-width: 4px;
|
| 276 |
border-color: rgba(255,255,255, 0.5);
|
| 277 |
}
|
| 278 |
|
| 279 |
.cursor.clicking {
|
| 280 |
+
/* Scale handled by JS */
|
| 281 |
background-color: rgba(255,255,255,0.3);
|
| 282 |
}
|
| 283 |
|
|
|
|
| 302 |
.playground-link {
|
| 303 |
padding: 0.7em 1.5em;
|
| 304 |
}
|
| 305 |
+
/* Reduce glow size on smaller screens */
|
| 306 |
+
.glow {
|
| 307 |
+
width: 500px;
|
| 308 |
+
height: 500px;
|
| 309 |
+
}
|
| 310 |
}
|
| 311 |
|
| 312 |
</style>
|
|
|
|
| 324 |
<div class="models-section">
|
| 325 |
<h2>Free Access To Premium Models</h2>
|
| 326 |
<div class="models-grid">
|
| 327 |
+
<!-- Updated Model List -->
|
| 328 |
<span class="model-badge">GPT-4o</span>
|
| 329 |
<span class="model-badge">GPT-4o-mini</span>
|
| 330 |
+
<span class="model-badge">OpenAI o1</span>
|
| 331 |
+
<span class="model-badge">OpenAI o3-mini</span>
|
| 332 |
+
<span class="model-badge">GPT-4.5</span>
|
| 333 |
<span class="model-badge">Claude 3.7 Sonnet</span>
|
| 334 |
+
<span class="model-badge">Gemini 1.5 Pro</span>
|
| 335 |
+
<span class="model-badge">Gemini 1.5 Flash</span>
|
| 336 |
<span class="model-badge">And More Top Models...</span>
|
| 337 |
</div>
|
| 338 |
</div>
|
|
|
|
| 351 |
const cursor = document.querySelector('.cursor');
|
| 352 |
const glow = document.querySelector('.glow');
|
| 353 |
const hoverables = document.querySelectorAll('a, .model-badge');
|
| 354 |
+
const textElements = document.querySelectorAll('h1, p, h2, .model-badge'); // Include badges for text hover
|
| 355 |
|
| 356 |
let mouseX = 0;
|
| 357 |
let mouseY = 0;
|
|
|
|
| 359 |
let cursorY = 0;
|
| 360 |
let glowX = 0;
|
| 361 |
let glowY = 0;
|
| 362 |
+
|
| 363 |
+
// Adjust speed for desired smoothness (lower = smoother, more 'lag')
|
| 364 |
+
const cursorSpeed = 0.15;
|
| 365 |
+
const glowSpeed = 0.1;
|
| 366 |
+
|
| 367 |
+
// Store current scale factor for smooth transitions
|
| 368 |
+
let currentCursorScale = 1;
|
| 369 |
+
const baseCursorScale = 1;
|
| 370 |
+
const hoverLinkCursorScale = 1.5;
|
| 371 |
+
const hoverTextCursorScale = 0.7;
|
| 372 |
+
const clickCursorScale = 0.6;
|
| 373 |
+
|
| 374 |
+
// Pre-calculate half-widths/heights ONCE (assuming they don't change)
|
| 375 |
+
// Note: If elements resize dynamically, might need recalculation
|
| 376 |
+
let cursorHalfWidth = cursor.offsetWidth / 2;
|
| 377 |
+
let cursorHalfHeight = cursor.offsetHeight / 2;
|
| 378 |
+
let glowHalfWidth = glow.offsetWidth / 2;
|
| 379 |
+
let glowHalfHeight = glow.offsetHeight / 2;
|
| 380 |
+
|
| 381 |
+
// Recalculate on resize just in case
|
| 382 |
+
window.addEventListener('resize', () => {
|
| 383 |
+
cursorHalfWidth = cursor.offsetWidth / 2;
|
| 384 |
+
cursorHalfHeight = cursor.offsetHeight / 2;
|
| 385 |
+
glowHalfWidth = glow.offsetWidth / 2;
|
| 386 |
+
glowHalfHeight = glow.offsetHeight / 2;
|
| 387 |
+
});
|
| 388 |
+
|
| 389 |
|
| 390 |
function animate() {
|
| 391 |
+
// Lerp for smooth following
|
| 392 |
+
cursorX += (mouseX - cursorX) * cursorSpeed;
|
| 393 |
+
cursorY += (mouseY - cursorY) * cursorSpeed;
|
| 394 |
glowX += (mouseX - glowX) * glowSpeed;
|
| 395 |
glowY += (mouseY - glowY) * glowSpeed;
|
| 396 |
|
| 397 |
+
// Apply transform for positioning and scaling
|
| 398 |
+
// Calculate the top-left position needed to center the element
|
| 399 |
+
const cursorTranslateX = cursorX - cursorHalfWidth;
|
| 400 |
+
const cursorTranslateY = cursorY - cursorHalfHeight;
|
| 401 |
+
const glowTranslateX = glowX - glowHalfWidth;
|
| 402 |
+
const glowTranslateY = glowY - glowHalfHeight;
|
| 403 |
+
|
| 404 |
+
cursor.style.transform = `translate(${cursorTranslateX}px, ${cursorTranslateY}px) scale(${currentCursorScale})`;
|
| 405 |
+
glow.style.transform = `translate(${glowTranslateX}px, ${glowTranslateY}px)`; // Glow doesn't scale dynamically here
|
| 406 |
|
| 407 |
requestAnimationFrame(animate);
|
| 408 |
}
|
|
|
|
| 410 |
document.addEventListener('mousemove', (e) => {
|
| 411 |
mouseX = e.clientX;
|
| 412 |
mouseY = e.clientY;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 413 |
});
|
| 414 |
|
| 415 |
// Start the animation loop
|
| 416 |
animate();
|
| 417 |
|
| 418 |
+
function updateCursorState() {
|
| 419 |
+
let targetScale = baseCursorScale;
|
| 420 |
+
let isHoveringLink = false;
|
| 421 |
+
let isHoveringText = false;
|
| 422 |
+
|
| 423 |
+
// Check hover states directly (more robust than relying on mouseenter/leave timing with lerp)
|
| 424 |
+
hoverables.forEach(el => {
|
| 425 |
+
const rect = el.getBoundingClientRect();
|
| 426 |
+
if (mouseX >= rect.left && mouseX <= rect.right && mouseY >= rect.top && mouseY <= rect.bottom) {
|
| 427 |
+
isHoveringLink = true;
|
| 428 |
+
}
|
| 429 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 430 |
|
| 431 |
+
textElements.forEach(el => {
|
| 432 |
+
// Avoid text hover if already hovering a link defined in hoverables
|
| 433 |
+
if (!isHoveringLink) {
|
| 434 |
+
const rect = el.getBoundingClientRect();
|
| 435 |
+
if (mouseX >= rect.left && mouseX <= rect.right && mouseY >= rect.top && mouseY <= rect.bottom) {
|
| 436 |
+
isHoveringText = true;
|
| 437 |
+
}
|
| 438 |
}
|
| 439 |
+
});
|
| 440 |
+
|
| 441 |
+
// Apply styles and target scale based on state
|
| 442 |
+
cursor.classList.toggle('hover-link', isHoveringLink);
|
| 443 |
+
cursor.classList.toggle('hover-text', isHoveringText && !isHoveringLink); // Only text hover if not link hover
|
| 444 |
+
|
| 445 |
+
if (isHoveringLink) {
|
| 446 |
+
targetScale = hoverLinkCursorScale;
|
| 447 |
+
} else if (isHoveringText) {
|
| 448 |
+
targetScale = hoverTextCursorScale;
|
| 449 |
+
}
|
| 450 |
+
|
| 451 |
+
// Handle clicking state separately
|
| 452 |
+
if (cursor.classList.contains('clicking')) {
|
| 453 |
+
// Optionally combine scales or prioritize click scale
|
| 454 |
+
targetScale = clickCursorScale; // Click scale overrides others
|
| 455 |
+
}
|
| 456 |
|
| 457 |
+
// Smoothly transition scale (optional, can also rely on CSS transition if preferred)
|
| 458 |
+
// currentCursorScale += (targetScale - currentCursorScale) * 0.2; // Lerp scale
|
| 459 |
+
// Simpler: Just set the target scale and let JS/CSS handle visual update
|
| 460 |
+
currentCursorScale = targetScale;
|
| 461 |
+
|
| 462 |
+
}
|
| 463 |
|
| 464 |
+
// Update state on mouse move for accuracy
|
| 465 |
+
document.addEventListener('mousemove', updateCursorState);
|
| 466 |
+
|
| 467 |
+
|
| 468 |
+
// Add/Remove clicking class
|
| 469 |
document.addEventListener('mousedown', () => {
|
| 470 |
cursor.classList.add('clicking');
|
| 471 |
+
updateCursorState(); // Re-evaluate state immediately on click
|
| 472 |
});
|
| 473 |
|
| 474 |
document.addEventListener('mouseup', () => {
|
| 475 |
cursor.classList.remove('clicking');
|
| 476 |
+
updateCursorState(); // Re-evaluate state immediately on release
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 477 |
});
|
| 478 |
|
| 479 |
+
// Initial state check in case mouse enters window over an element
|
| 480 |
+
updateCursorState();
|
| 481 |
+
|
| 482 |
</script>
|
| 483 |
</body>
|
| 484 |
</html>
|