使用CATransform3DMakeRotation平滑水平翻转 [英] Smooth horizontal flip using CATransform3DMakeRotation

查看:377
本文介绍了使用CATransform3DMakeRotation平滑水平翻转的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已设置以下动画以在不同大小的视图之间旋转。随着新的,更高的视图进入视野,动画的中点似乎有一个闪烁。我能做些什么来平滑过渡。

I have set up the following animation to rotate between views of different sizes. The midpoint of the animation seems to have a flicker as the new, taller view comes into view. Is there anything I can do to smoothen the transition.

newView.layer.transform = CATransform3DMakeRotation(M_PI_2, 0.0, 1.0, 0.0);

[UIView animateWithDuration:0.5
                          delay:0
                        options:UIViewAnimationOptionCurveLinear
                     animations:^{oldView.layer.transform = CATransform3DMakeRotation(M_PI_2, 0.0, -1.0, 0.0);}
                     completion:^(BOOL finished) {

                         [oldView removeFromSuperview];
                         [UIView animateWithDuration:0.5
                                               delay:0
                                             options:UIViewAnimationOptionCurveLinear
                                          animations:^{newView.layer.transform = CATransform3DMakeRotation(M_PI_2, 0.0, 0.0, 0.0);}
                                          completion:nil];

    }];


推荐答案

我已经到了一半,但缺少一块,设置转换矩阵的m34单元格值 ,诀窍。

I was halfway there, but the missing piece, setting the m34 cell value of the transformation matrix, did the trick.

这篇关于使用CATransform3DMakeRotation平滑水平翻转的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆