Created
January 6, 2022 07:27
-
-
Save anthonypena97/3ab82bf1a51688bf782825f13a689f73 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// from work with three.js project | |
// desktop pointer | |
pointer.x = (event.clientX / window.innerWidth) * 2 - 1; | |
pointer.y = - (event.clientY / window.innerHeight) * 2 + 1; | |
// mobile touch | |
pointer.x = +(event.targetTouches[0].pageX / window.innerWidth) * 2 + -1; | |
pointer.y = -(event.targetTouches[0].pageY / window.innerHeight) * 2 + 1; | |
//mobile click | |
pointer.x = (event.clientX / window.innerWidth) * 2 - 1; | |
pointer.y = - (event.clientY / window.innerHeight) * 2 + 1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment