Created
October 13, 2018 20:24
-
-
Save chrishutchinson/14c0bb49c17a45cd565d1aa2089e9ea8 to your computer and use it in GitHub Desktop.
Hacking with JavaScript and Shortcuts (#2)
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
const handleOrientation = event => { | |
const x = event.beta; | |
if (x < 40 && x > 20) return; | |
if (x > 40 && x <= 60) { | |
window.scrollBy(0, 1); | |
} else if (x > 60) { | |
window.scrollBy(0, 2); | |
} else { | |
window.scrollBy(0, -1); | |
} | |
}; | |
window.addEventListener("deviceorientation", handleOrientation); | |
completion(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment