question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Matrix transform support

See original GitHub issue

Hey, 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:

screenshot 2018-09-03 at 17 48 21

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:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
raffaelercommented, Apr 18, 2020

@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 😉

0reactions
wcandilloncommented, Apr 18, 2020

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/files

It looks like matrices may never need to be exposed to React Native developers as a public API, which I find exciting 😃

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found