<div id="cursorBlob"></div>
<div class="wrap">
<ul class="nav">
<li class="nav__link">Home</li>
<li class="nav__link">About us</li>
<li class="nav__link">Contact Us</li>
</ul>
</div>
@import url("https://fonts.googleapis.com/css?family=Montserrat:900");
body {
overflow: hidden;
margin: 0;
}
* {
box-sizing: border-box;
}
#cursorBlob {
width: 50px;
height: 50px;
background: linear-gradient(120deg, #FF1744, #E040FB, #2979FF, #00E5FF, #76FF03);
background-size: 1600% 1600%;
position: absolute;
mix-blend-mode: difference;
pointer-events: none;
z-index: 1;
transition: 0.3s linear;
animation: blobRadius 5s ease infinite, blobBackground 15s ease infinite;
}
@keyframes blobRadius {
0%, 100% {
border-radius: 43% 77% 80% 40%/40% 40% 80% 80%;
}
20% {
border-radius: 47% 73% 61% 59%/47% 75% 45% 73%;
}
40% {
border-radius: 46% 74% 74% 46%/74% 58% 62% 46%;
}
60% {
border-radius: 47% 73% 61% 59%/40% 40% 80% 80%;
}
80% {
border-radius: 50% 70% 52% 68%/51% 61% 59% 69%;
}
}
@keyframes blobBackground {
0%, 100% {
background-position: 0% 50%;
}
50% {
background-position: 100% 50%;
}
}
.wrap {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
width: 100vw;
background: #212121;
}
.nav {
display: flex;
flex-direction: column;
margin: 0;
padding: 0;
}
.nav__link {
color: #fff;
list-style: none;
cursor: pointer;
font-size: 5vw;
font-family: "Montserrat", sans-serif;
transition: 0.25s ease;
}
.nav__link:not(:last-child) {
margin-bottom: 50px;
}
.nav__link:hover {
transform: translateX(25px);
}
const blobCursor = (() => {
const cursor = document.querySelector('#cursorBlob');
const links = document.querySelectorAll('.nav__link');
const setCursorPos = (e) => {
const { pageX: posX, pageY: posY } = e;
cursor.style.top = `${posY - (cursor.offsetHeight / 2)}px`;
cursor.style.left = `${posX - (cursor.offsetWidth / 2)}px`;
};
document.addEventListener('mousemove', setCursorPos);
const setCursorHover = () => cursor.style.transform = 'scale(2.5)';
const removeCursorHover = () => cursor.style.transform = '';
links.forEach(link => link.addEventListener('mouseover', setCursorHover));
links.forEach(link => link.addEventListener('mouseleave', removeCursorHover));
})();
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.