Skip to content

Instantly share code, notes, and snippets.

@ochanje210
Last active March 2, 2017 05:24
Show Gist options
  • Select an option

  • Save ochanje210/6bf748cb89ca96bd575cb6565fe634e1 to your computer and use it in GitHub Desktop.

Select an option

Save ochanje210/6bf748cb89ca96bd575cb6565fe634e1 to your computer and use it in GitHub Desktop.
handlePanResponderMove (e, gestureState) {
const {dx, dy} = gestureState;
const origin = {x: 0, y: 0, z: -yourSquareSidelength / 2};
let matrix = this.rotateXY(dx, dy);
transformOrigin(matrix, origin);
this.refViewFront.setNativeProps({style: {transform: [{perspective: 1000}, {matrix: matrix}]}});
matrix = this.rotateXY(dx + 180, dy);
transformOrigin(matrix, origin);
this.refViewBack.setNativeProps({style: {transform: [{perspective: 1000}, {matrix: matrix}]}});
matrix = this.rotateXY(dx + 90, dy);
this.transformOrigin(matrix, origin);
this.refViewRight.setNativeProps({style: {transform: [{perspective: 1000}, {matrix: matrix}]}});
matrix = this.rotateXY(dx - 90, dy);
this.transformOrigin(matrix, origin);
this.refViewLeft.setNativeProps({style: {transform: [{perspective: 1000}, {matrix: matrix}]}});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment