Skip to content

Commit

Permalink
Merge pull request #998 from akash70629/main
Browse files Browse the repository at this point in the history
🛠️FIX : Missing mouse animation added
  • Loading branch information
ankit071105 authored Nov 6, 2024
2 parents aea7136 + b8c51c8 commit aca66e2
Showing 1 changed file with 112 additions and 0 deletions.
112 changes: 112 additions & 0 deletions contactus.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Contact Us - Trainline</title>
<style>

/* cursor animation */

.circle {
height: 24px;
width: 24px;
border-radius: 24px;
background-color: black;
position: fixed;
top: 0;
left: 0;
pointer-events: none;
z-index: 99999999; /* so that it stays on top of all other elements */
}

/* Basic Reset */
* {
margin: 0;
Expand Down Expand Up @@ -348,6 +363,34 @@
</head>
<body>

<div class="cursor"></div>
<div class="cursor-trail"></div>



<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>


<!-- Navigation -->
<nav class="navbar">
<img src="https://ticket-booking-blue.vercel.app/images/4.jpeg" alt="" style="border-radius: 50%; height: 35px; width: 35px;">
Expand Down Expand Up @@ -1058,6 +1101,75 @@ <h4>FIND US</h4>
} else {
navlinks.style.display = 'none'; // Hide links if starting on a small screen
}

// cursor

const coords = { x: 0, y: 0 };
const circles = document.querySelectorAll(".circle");

const colors = [

"#BCE954",
"#98FF98",
"#9CB071",
"#90C209",
"#B2C248",
"#85BB65",
"#99C68E",
"#6CBB3C",
"#3ea055",
"#41a317",
"#4AA02C",
"#6AA121",
"#347C2C",
"#387C44",
"#437C17",
"#306754",
"#254117",
"#667C26",
"#728C00",
"#008000"

];

circles.forEach(function (circle, index) {
circle.x = 0;
circle.y = 0;
circle.style.backgroundColor = colors[index % colors.length];
});

window.addEventListener("mousemove", function(e){
coords.x = e.clientX;
coords.y = e.clientY;

});

function animateCircles() {

let x = coords.x;
let y = coords.y;

circles.forEach(function (circle, index) {
circle.style.left = x - 12 + "px";
circle.style.top = y - 12 + "px";

circle.style.scale = (circles.length - index) / circles.length;

circle.x = x;
circle.y = y;

const nextCircle = circles[index + 1] || circles[0];
x += (nextCircle.x - x) * 0.3;
y += (nextCircle.y - y) * 0.6;
});

requestAnimationFrame(animateCircles);
}

animateCircles();



</script>
</body>
</html>

0 comments on commit aca66e2

Please sign in to comment.