Basics example of using CATransform3D functions in Swift
- 3D transformations in X,Y,Z axis
- Moving the anchor point from default (0.5,0.5)
- Set m34 (matrix element in the 3rd row at the 4th column) for your z-axis perspective
- 4x4 Matrix for 3D Spaces
// 4x4 Matrix
[X][0][0][0]
[0][Y][0][0]
[0][0][Z][0]
[0][0][0][1]
// Structure in Swift
public struct CATransform3D {
public init(m11: CGFloat, m12: CGFloat, m13: CGFloat, m14: CGFloat,
m21: CGFloat, m22: CGFloat, m23: CGFloat, m24: CGFloat,
m31: CGFloat, m32: CGFloat, m33: CGFloat, m34: CGFloat,
m41: CGFloat, m42: CGFloat, m43: CGFloat, m44: CGFloat)
}
Anak Mirasing