我有一个UIView
,我试图动画向下翻转,同时让它的轴位于视图的底部。 E.g:
为此,我尝试使用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);
}];
现在它不按照我想要的方式运行,看起来这个视图正在向用户设置动画而不是向用户动画。它似乎没有给出一种3D效果,使其在向下旋转时看起来更贴近用户,如我的图像所示。我很肯定这是因为我对如何使用CATransform3DMakeRotation
缺乏了解。
问题:
anchorPoint
时,它会将我的视图向下移动,如何阻止此操作并仍设置anchorPoint
?UIView
动画,我可以使用缓动设置吗?UIViewAnimationCurveEaseOut
。答案 0 :(得分:2)
transform
需要设置m34
元素,如here所述。anchorPoint
,您需要更改视图的原始位置。UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionCurveEaseInOut | UIViewAnimationOptionAllowUserInteraction
。