Created
December 6, 2018 00:42
-
-
Save Craigtut/6632a9ac7cfff55e74fb561862bc4edb to your computer and use it in GitHub Desktop.
Clockwise rotation with translation.
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
// event from touch event on a view | |
const { pageX, pageY } = event.nativeEvent; | |
const x0 = pageX / Metrics.screenWidth; | |
const y0 = pageY / Metrics.screenHeight; | |
const x = y0; | |
const y = -x0 + 1; | |
// x and y have now been rotated 90 deg clockwise and translated back into normalized coordinates. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
what's the Metrics?