gpt4 book ai didi

iphone - 如何在UIView中应用变换?

转载 作者:行者123 更新时间:2023-12-01 18:27:34 24 4
gpt4 key购买 nike

我已经将下面的转换应用到了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;

但是没有太大的成功,我只想应用如下图所示的转换

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

最佳答案

也许这会有所帮助

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;

关于iphone - 如何在UIView中应用变换?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12018994/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com