Skip to content

Instantly share code, notes, and snippets.

@julianfrank
Created September 12, 2019 12:27
Show Gist options
  • Save julianfrank/e38867ac1b36eca7992c1e40e41ceae9 to your computer and use it in GitHub Desktop.
Save julianfrank/e38867ac1b36eca7992c1e40e41ceae9 to your computer and use it in GitHub Desktop.
Mouse Pointer Tracker
window.addEventListener('mousemove', function(e) {
var x = (e.clientX / window.innerWidth * 2) - 1;
var y = (e.clientY / window.innerHeight * -2) + 1;
console.log(x,y)
// something awesome
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment