Matrix transform support
See original GitHub issueHey, is there any way to use animated values from this lib inside matrix transformation? I have few animations where I had to change transform origin and since it’s not supported in react native, matrix was the least hacky way to do that, unfortunately I’m getting cryptic error:
Basic sample:
import A from 'react-native-reanimated';
const deg = new A.Value(23);
const rad = A.multiply(A.divide(Math.PI, 180), deg);
const cos = A.cos(rad);
const sin = A.sin(rad);
const zAxisRotation = [
cos, -sin, 0, 0,
sin, cos, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1,
];
const Sample = () => {
return (
<A.View
style={{
transform: [{
matrix: zAxisRotation,
}]
}}
/>
);
};
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
matrix() - CSS: Cascading Style Sheets - MDN Web Docs
The matrix() CSS function defines a homogeneous 2D transformation matrix. Its result is a <transform-function> data type.
Read more >Matrices as transformations (article) - Khan Academy
If we think about a matrix as a transformation of space it can lead to a deeper understanding of matrix operations. This viewpoint...
Read more >types: `<transform-function>`: `matrix()` - CanIUse
"Can I use" provides up-to-date browser support tables for support of front-end web technologies on desktop and mobile web browsers.
Read more >Transfomation Matrix - Code Industry
Transormation matrix is used to calculate new coordinates of transformed object. By changing values of transformation matrix, it is possible to apply any ......
Read more >What Is Transformation Matrix and How to Use It
A transformation matrix allows to alter the default coordinate system and map the original coordinates (x, y) to this new coordinate system: (x',...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@wcandillon you pull request is definitely useful, but matrices are not limited to transforms. The entire graphics world is built on matrix support and most of the graphics algorithms are based on matrices. Not having matrices support in the codebase is like using tricycle instead of a motorbike 😉
I’m adding support to an
accumulatedTransform()
function in redash that solves the issue of keeping the state of a transformation into a matrix: https://github.com/wcandillon/react-native-redash/pull/224/filesIt looks like matrices may never need to be exposed to React Native developers as a public API, which I find exciting 😃