OGeek|极客世界-中国程序员成长平台

标题: iOS UIView 动画 CATransform3DMakeRotation 混淆 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-11 20:43
标题: iOS UIView 动画 CATransform3DMakeRotation 混淆

我有一个 UIView 我正在尝试动画向下翻转,同时它的轴位于 View 的底部。例如:

enter image description here

为此,我尝试使用 UIView 动画:

[UIView animateWithDuration:3 delay:0 options:UIViewAnimationCurveEaseOut animations:^{

     // Flip Down
     top3.layer.anchorPoint = CGPointMake(0.5, 1.0);
     top3.layer.transform = CATransform3DMakeRotation(M_PI, 1, 0, 0);

 } completion:^(BOOL finished) {

     // Reset?
     //top3.transform = CGAffineTransformMakeScale(1, 1);

 }];

现在它没有按我想要的方式工作,看起来 View 动画远离用户而不是朝向用户。它似乎没有提供 3D 效果,使其在向下旋转时看起来更接近用户,如我的图像所示。我很肯定这是因为我不了解如何使用 CATransform3DMakeRotation

问题:



Best Answer-推荐答案


关于iOS UIView 动画 CATransform3DMakeRotation 混淆,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8494184/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4