JSFiddle - React, Tailwind, and code Playground
by Gothdo
HTML
<div class="follower"></div>
<p>Try moving the cursor.</p>
CSS
.follower {
display: block;
content: '';
width: 150px;
height: 150px;
background-image: url(https://img00.deviantart.net/5f03/i/2012/277/3/0/twilight_sparkle___happyness_by_anbolanos91-d5gsh80.png);
background-size: contain;
background-repeat: no-repeat;
border-radius: 10px;
transition-duration: 200ms;
transition-timing-function: ease-out;
position: fixed;
transform: translateX(-50%) translateY(-50%);
}
JavaScript
$(document).on('mousemove', (event) => {
$('.follower').css({
left: event.clientX,
top: event.clientY,
});
});