【问题标题】:the right way of react native matrix 2d?反应原生矩阵 2d 的正确方法?
【发布时间】:2016-08-14 00:29:03
【问题描述】:

我有一个类似 css3 的转换格式

transform: matrix(1, 0, 0, 1, 5, 5);

那么反应原生“矩阵数组”是什么?

matrix1: [
1, 0, 0,
0, 1, 0,
5, 5, 1
]

matrix2: [
1, 0, 0,
1, 5, 5,
0, 0, 1
]

matrix3:[
1, 0, 5,
0, 1, 5,
0, 0, 1
]

视图中的所有内容都不对......

【问题讨论】:

    标签: css matrix react-native


    【解决方案1】:

    React Native 使用 3D 矩阵,因此您的矩阵需要为 4x4。详情请见https://github.com/facebook/react-native/blob/master/Libraries/Utilities/MatrixMath.js

    【讨论】:

      【解决方案2】:

      React Native 还提供了将矩阵分解为转换的函数:https://github.com/facebook/react-native/blob/master/Libraries/Utilities/MatrixMath.js#L571

      注意使用相同格式的 4x4 行主矩阵

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2019-09-20
        • 1970-01-01
        • 2016-02-01
        • 2017-03-08
        • 2016-05-11
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多