yequari.com/themes/dreamcast/static/js/main.js

15 lines
365 B
JavaScript
Raw Normal View History

2024-10-02 03:08:48 +00:00
const root = document.documentElement;
let mouseX = 0;
let mouseY = 0;
document.addEventListener("mousemove", (evt) => {
mouseX = evt.clientX / innerWidth;
mouseY = evt.clientY / innerHeight;
root.style.setProperty("--mouse-x", `${mouseX}`);
root.style.setProperty("--mouse-y", `${mouseY}`);
console.log(root.style.getPropertyValue("--mouse-x"));
});