Content-Length: 259075 | pFad | http://github.com/jmurzy/react-native-foldview/commit/2c13d94451afad7061673fc1caee60899d5de675

D7 fix perspective, multiply the result matrix by perspective matrix (#27) · jmurzy/react-native-foldview@2c13d94 · GitHub
Skip to content

Commit

Permalink
fix perspective, multiply the result matrix by perspective matrix (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
ErrorPro authored and jmurzy committed Jul 4, 2018
1 parent c56d394 commit 2c13d94
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/FoldView.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,17 +209,18 @@ export default class FoldingCell extends Component {

flushTransform(ref, dx, y) {
// Matrix multiplication is not commutative
const matrix = transformUtil.rotateX(dx);
const matrix = transformUtil.createIdentityMatrix();
const rotate = transformUtil.rotateX(dx);
transformUtil.origen(matrix, { x: 0, y, z: 0 });

const perspective = this.props.perspective || rootDefaultProps.perspective;
transformUtil.applyPerspective(
matrix,
this.props.perspective || rootDefaultProps.perspective,
);
transformUtil.multiplyInto(matrix, matrix, rotate);

ref.setNativeProps({
style: {
transform: [
{
perspective,
},
{
matrix,
},
Expand Down
9 changes: 9 additions & 0 deletions src/transformUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,16 @@ function rotateX(deg) {
];
}

function applyPerspective(matrix, value) {
const perspective = MatrixMath.createIdentityMatrix();
MatrixMath.reusePerspectiveCommand(perspective, value);
MatrixMath.multiplyInto(matrix, matrix, perspective);
}

export default {
rotateX,
applyPerspective,
createIdentityMatrix: MatrixMath.createIdentityMatrix,
multiplyInto: MatrixMath.multiplyInto,
origen: transformOrigin,
};

0 comments on commit 2c13d94

Please sign in to comment.








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/jmurzy/react-native-foldview/commit/2c13d94451afad7061673fc1caee60899d5de675

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy