Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Clockwise rotation with translation.
// 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