我正试图理解如何创建对我的UIView这样的深度感知:

我试过这段代码:
var rotationWithPerspective = CATransform3DIdentity;
rotationWithPerspective.m34 = -1.0/500.0/2/2
rotationWithPerspective = CATransform3DRotate(rotationWithPerspective, 22.5, 0, 1, 0);
preview.layer.transform = rotationWithPerspective这就产生了透视。然而,它的翻转视图出于某种原因。
( 1)如何避免变换后的“翻转”?
2)转换产生的“透视深度”对每个给定的UIView都是相同的,还是取决于UIView的大小等?
谢谢!
发布于 2016-02-17 03:55:56
CATransform3DRotate预计弧度不是度。你旋转22.5度,大约1200度。这可能就是你的形象倒置的原因。您可能想使用这个:
let radians = 22.5 * M_PI / 180
rotationWithPerspective = CATransform3DRotate(rotationWithPerspective, radians, 0, 1, 0);发布于 2017-06-13 13:07:57
( 2)
你可以阅读更多关于它的iOS核心动画-先进技术的尼克洛克伍德。希望能帮上忙。
https://stackoverflow.com/questions/35446457
复制相似问题