I'm using the following snippet to track the mouse position and to append some styles:
const blob = document.getElementById("blob");
window.onpointermove = event => {
const { clientX, clientY } = event;
blob.animate({
left: `${clientX}px`,
top: `${clientY}px`
}, { duration: 3000, fill: "forwards" });
}
Everything works as I wish until I start scrolling. Then the positions sticks to where I started scrolling and wont catch up. You can see the demo here: https://wordpress-318817-3165474.cloudwaysapps.com/index.php/version-3/
I'm stuck and don't know what I did wrong. I hope someone can help me out.