ios - 如何在不相互抵消的情况下组合 2 个 3D 旋转?

标签 ios objective-c swift catransform3d

我有一个 View ,我想在两个不同的方向上旋转。

第一个是:

arrowImageView.layer.transform = CATransform3DMakeRotation(rotationAngle, 0, 0, 1)

第二个是:

arrowImageView.layer.transform = CATransform3DMakeRotation(pitch, 1, 0, 0)

如何在不取消其中一个的情况下合并这两个旋转?

最佳答案

您将 3D 转换与 CATransform3DConcat() 相结合:

let t1 = CATransform3DMakeRotation(rotationAngle, 0, 0, 1)
let t2 = CATransform3DMakeRotation(pitch, 1, 0, 0)
arrowImageView.layer.transform = CATransform3DConcat(t1, t2)

关于ios - 如何在不相互抵消的情况下组合 2 个 3D 旋转?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31762207/

相关文章:

ios - 自定义 XIB 未加载问题

ios - 自定义编辑菜单中 UIMenuItems 的顺序

objective-c - 连接 NSString 和 int 的最简单方法

ios - 返回到相同条件下的上一个场景

ios - 如何读取特征值?

iphone - iOS 核心数据使用现有的 SQLite?

ios - 如何在 iPhone 中禁用横向但在 iPad 上保持启用?

ios - 如何根据拖动/滚动或只是点击来传递点击以查看

iOS 等同于 onRestart()

ios - 如何通过按钮关闭并重新打开 viewController?