如何在UIView中应用变换? [英] How to apply transform in UIView?
本文介绍了如何在UIView中应用变换?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已将以下变换应用于UIView的图层,如下所示:
I have applied below transform to UIView's layer like this:
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;
但是没有那么多成功我只是想应用变换如下图所示
But not so much success i just wanted to apply transform like shown below image
任何帮助都非常感谢。感谢您阅读我的问题
Any help would so much appreciated. Thanks for reading my Question
推荐答案
也许这可能会有所帮助
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;
这篇关于如何在UIView中应用变换?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文