-
Notifications
You must be signed in to change notification settings - Fork 839
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3101 from MitulSonagara/mouse_transition_effect
Mouse transition effect
- Loading branch information
Showing
3 changed files
with
69 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
.cursor { | ||
z-index: 999; | ||
position: fixed; | ||
background: #23bdf5; | ||
width: 20px; | ||
height: 20px; | ||
border-radius: 50%; | ||
pointer-events: none; | ||
box-shadow: 0 0 20px #23bdf5, | ||
0 0 60px #23bdf5, | ||
0 0 100px #23bdf5; | ||
animation: colors 1s infinite; | ||
transform: translate(-50%, -50%); | ||
display: none; | ||
} | ||
|
||
@keyframes colors { | ||
0% { | ||
filter: hue-rotate(0deg); | ||
} | ||
|
||
100% { | ||
filter: hue-rotate(360deg); | ||
} | ||
} | ||
|
||
.cursor:before { | ||
content: ''; | ||
position: absolute; | ||
background: #23bdf5; | ||
width: 50px; | ||
height: 50px; | ||
opacity: 0.2; | ||
transform: translate(-30%, -30%); | ||
border-radius: 50%; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
document.addEventListener("DOMContentLoaded", function () { | ||
const cursor = document.querySelector(".cursor"); | ||
var timeout; | ||
|
||
document.addEventListener("mousemove", (e) => { | ||
let x = e.clientX; | ||
let y = e.clientY; | ||
|
||
cursor.style.top = y + "px"; | ||
cursor.style.left = x + "px"; | ||
cursor.style.display = "block"; | ||
|
||
function mouseStopped() { | ||
cursor.style.display = "none"; | ||
} | ||
|
||
clearTimeout(timeout); | ||
timeout = setTimeout(mouseStopped, 1000); | ||
}); | ||
|
||
document.addEventListener("scroll", () => { | ||
cursor.style.display = "none"; | ||
}); | ||
|
||
document.addEventListener("mouseout", () => { | ||
cursor.style.display = "none"; | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,6 +49,7 @@ | |
<link rel="stylesheet" href="./assets/css/gameCard.css"> | ||
<link rel="stylesheet" href="./assets/css/navbar.css"> | ||
<link rel="stylesheet" href="./assets/css/gameCard.css"> | ||
<link rel="stylesheet" href="./assets/css/cursor_transition.css"> | ||
|
||
<!-- | ||
- google font link | ||
|
@@ -75,7 +76,7 @@ | |
</label> --> | ||
|
||
<body> | ||
|
||
<div class="cursor"></div> | ||
<!-- BACKGROUND PARTICLES --> | ||
<!-- <div class="page-bg"></div> --> | ||
<!-- <div class="animation-wrapper"> --> | ||
|
@@ -233,6 +234,8 @@ <h1>Our Valuable Contributors</h1> | |
<script src="./assets/js/script.js"></script> | ||
<script src="./assets/js/scroll.js"></script> | ||
<script src="./assets/js/contributors.js"></script> | ||
<script src="./assets/js/cursor_transition.js"></script> | ||
|
||
|
||
|
||
<script type="module" src="https://unpkg.com/[email protected]/dist/ionicons/ionicons.esm.js"></script> | ||
|
@@ -251,4 +254,4 @@ <h1>Our Valuable Contributors</h1> | |
|
||
</body> | ||
|
||
</html> | ||
</html> |