我已将下面的变换应用到UIView的图层:
CATransform3D rotationAndPerspectiveTransform = CATransform3DIdentity;
rotationAndPerspectiveTransform.m34 = 1.0 / -850;
rotationAndPerspectiveTransform = CATransform3DRotate(rotationAndPerspectiveTransform, M_PI_4*1.1,0.0f, 1.2f, 0.0f);
self.centerView.layer.transform = rotationAndPerspectiveTransform;
但没有那么多成功,我只是想应用如下图所示的转换
任何帮助都会非常感激。感谢您阅读我的问题
答案 0 :(得分:4)
也许这可能会有所帮助
CATransform3D t1 = CATransform3DIdentity;
t1.m34 = 1.0/-850;
t1 = CATransform3DScale(t1, 0.95, 0.95, 1);
t1 = CATransform3DRotate(t1, 15.0f*M_PI_4/180.0f, 0, 1.2, 0);
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform"];
animation.toValue = [NSValue valueWithCATransform3D:t1];
animation.duration = 1;
animation.fillMode = kCAFillModeForwards;
animation.removedOnCompletion = NO;