【发布时间】:2020-09-28 17:14:10
【问题描述】:
我写了一个代码,它应该通过 Z 轴转动 UILabel,然后通过 Y 轴来模拟透视。下面是示例代码:
var t: CATransform3D = CATransform3DIdentity
t = CATransform3DRotate(t, 270 * CGFloat.pi / 180, 0, 0, 1) // rotate by z axis
t = CATransform3DRotate(t, -50 * CGFloat.pi / 180, 0, 1, 0) // rotate by y axis
t.m34 = 1.0 / -500
logLabel.transform3D = t // implement sequence of rotations to label
contentView.addSubview(logLabel)
Z 轴正确旋转,Y 轴不旋转。第二次旋转使标签看起来很窄。如何模拟透视?
【问题讨论】: