1

我已将以下转换应用于 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;

但没有那么成功,我只是想应用变换,如下图所示在此处输入图像描述

任何帮助将不胜感激。感谢您阅读我的问题

4

1 回答 1

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;
于 2012-08-18T14:51:56.067 回答