我可以获得CATransform3DIdentity的基本解释吗?

时间:2011-08-20 00:54:27

标签: ios core-animation calayer catransform3d

我正在慢慢地对核心动画变得更加认真,并且会非常欣赏由简短的单词组成的解释(键入?)慢慢解释CATransform3DIdentity以及为什么以下代码执行它所做的事情(在“3D”空间中翻转图层)

    kFaceUpTransform = kFaceDownTransform = CATransform3DIdentity;
    // Construct a 180-degree rotation matrix:
    kFaceDownTransform.m11 = kFaceDownTransform.m33 = -1;

第二个想法,快速输入并使用多音节词来表达你的内心,但请保持温柔。

PS。我得到的印象是,如果我要进一步了解动画,我应该对线性代数感到更舒服......这是正确的吗?

1 个答案:

答案 0 :(得分:14)

CATransform3DIdentity是一个Identity矩阵:

http://en.wikipedia.org/wiki/Identity_matrix

基本上,动画数学中的矩阵用于变换对象(倾斜,移动,旋转等)。

Identity矩阵是指应用于某个对象时,会将其重置为初始地理位置。

离。
[1 0 0]
[0 1 0]
[0 0 1]

这不容易解释(我真的不能公平地理解我自己)但是这些3x3矩阵使用网格位置(m11,m33)来确定如何变换对象,在这种情况下m11正在使其旋转180度,将其设置为+1,然后旋转另一个方向。 将它设置为0.5并旋转90度(iirc!)。

离。
[m11,m12,m13]
[m21,m22,m23]
[m31,m32,m33]

这有点可怕,但这里的图片有点帮助:

http://en.wikipedia.org/wiki/Matrix_(mathematics)#Linear_transformations

在这里

http://en.wikipedia.org/wiki/Transformation_matrix

最后,此列表底部的表格显示了如何使用矩阵的不同字段:

Provided via 'internet wayback machine': http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CoreAnimation_guide/Articles/Layers.html

最后,我记得刚才读到这篇文章,它可能会有所帮助,因为我认为我上面的解释并不那么方便 - 我告诉你什么,不是为什么 - 而且相信我,你需要知道为什么正确地进入这种编程:

http://chortle.ccsu.edu/vectorlessons/vectorIndex.html

祝你好运!