|
39 | 39 | </head>
|
40 | 40 |
|
41 | 41 | <body class="page-leaderboard">
|
| 42 | + <div class="circle-container"> |
| 43 | + <div class="circle" style="background-color: #55a5ea; left: 504px; top: 59px; scale: 1;"></div> |
| 44 | + <div class="circle" style="background-color: #55a5ea; left: 504px; top: 59px; scale: 0.95;"></div> |
| 45 | + <div class="circle" style="background-color: #55a5ea; left: 504px; top: 59px; scale: 0.9;"></div> |
| 46 | + <div class="circle" style="background-color: #55a5ea; left: 504px; top: 59px; scale: 0.9;"></div> |
| 47 | + <div class="circle" style="background-color: #3fbcc0c6; left: 504px; top: 59px; scale: 0.85;"></div> |
| 48 | + <div class="circle" style="background-color: #3fbcc0c6; left: 504px; top: 59px; scale: 0.85;"></div> |
| 49 | + <div class="circle" style="background-color: #3fbcc0c6; left: 504px; top: 59px; scale: 0.85;"></div> |
| 50 | + <div class="circle" style="background-color: #3fbcc0c6; left: 504px; top: 59px; scale: 0.85;"></div> |
| 51 | + <div class="circle" style="background-color: #fff; left: 504px; top: 59px; scale: 0.8;"></div> |
| 52 | + <div class="circle" style="background-color: #fff; left: 504px; top: 59px; scale: 0.8;"></div> |
| 53 | + <div class="circle" style="background-color: #fff; left: 504px; top: 59px; scale: 0.8;"></div> |
| 54 | + <div class="circle" style="background-color: #fff; left: 504px; top: 59px; scale: 0.8;"></div> |
| 55 | + </div> |
42 | 56 | <!-- Body of the webpage. Background color set inline. -->
|
43 | 57 | <nav class="nav">
|
44 | 58 | <!-- Navigation section. -->
|
|
327 | 341 | </footer>
|
328 | 342 | </body>
|
329 | 343 | <script>
|
| 344 | +//Custom Cursor |
330 | 345 |
|
| 346 | +const coords = { x: 0, y: 0 }; |
| 347 | + const circles = document.querySelectorAll(".circle"); |
| 348 | +
|
| 349 | + const colors = [ |
| 350 | + "#55a5ea", |
| 351 | + "#55a5ea", |
| 352 | + "#55a5ea", |
| 353 | + "#55a5ea", |
| 354 | + "#55a5ea", |
| 355 | + "#55a5ea", |
| 356 | + "#55a5ea", |
| 357 | + "#55a5ea", |
| 358 | + "#3fbcc0c6", |
| 359 | + "#3fbcc0c6", |
| 360 | + "#3fbcc0c6", |
| 361 | + "#3fbcc0c6", |
| 362 | + "#3fbcc0c6", |
| 363 | + "#3fbcc0c6", |
| 364 | + "fff", |
| 365 | + "fff", |
| 366 | + "fff", |
| 367 | + "fff", |
| 368 | + "fff", |
| 369 | + "fff", |
| 370 | + "fff", |
| 371 | + ]; |
| 372 | +
|
| 373 | + circles.forEach(function (circle, index) { |
| 374 | + circle.x = 0; |
| 375 | + circle.y = 0; |
| 376 | + circle.style.backgroundColor = colors[index % colors.length]; |
| 377 | + }); |
| 378 | +
|
| 379 | + window.addEventListener("mousemove", function (e) { |
| 380 | + coords.x = e.clientX; |
| 381 | + coords.y = e.clientY; |
| 382 | + }); |
| 383 | +
|
| 384 | + function animateCircles() { |
| 385 | + let x = coords.x; |
| 386 | + let y = coords.y; |
| 387 | +
|
| 388 | + circles.forEach(function (circle, index) { |
| 389 | + circle.style.left = x - 12 + "px"; |
| 390 | + circle.style.top = y - 12 + "px"; |
| 391 | +
|
| 392 | + circle.style.scale = (circles.length - index) / circles.length; |
| 393 | +
|
| 394 | + circle.x = x; |
| 395 | + circle.y = y; |
| 396 | +
|
| 397 | + const nextCircle = circles[index + 1] || circles[0]; |
| 398 | + x += (nextCircle.x - x) * 0.3; |
| 399 | + y += (nextCircle.y - y) * 0.3; |
| 400 | + }); |
| 401 | +
|
| 402 | + requestAnimationFrame(animateCircles); |
| 403 | + } |
| 404 | +
|
| 405 | + animateCircles(); |
331 | 406 |
|
332 | 407 | document.querySelector('.toggler').addEventListener('click', function () {
|
333 | 408 | document.querySelector('.social-icons').classList.toggle('show-icons');
|
|
0 commit comments