CATransition *animation = [CATransition animation];
animation.duration = 1.0;
animation.type = @"cube"; //类型可以如下写
animation.subtype = kCATransitionFromRight;
[self.view.layer addAnimation:animation forKey:nil];
2.1 public类型 公有的类型的动画类型
淡化、推挤、揭开、覆盖
NSString * const kCATransitionFade;
NSString * const kCATransitionMoveIn;
NSString * const kCATransitionPush;
NSString * const kCATransitionReveal;
这四种,transition.subtype 也有四种NSString * const kCATransitionFromRight;
NSString * const kCATransitionFromLeft;
NSString * const kCATransitionFromTop;
NSString * const kCATransitionFromBottom;
2.2 私有的类型的动画类型:立方体、吸收、翻转、波纹、翻页、反翻页、镜头开、镜头关
animation.type = @"cube"
animation.type = @"suckEffect";
animation.type = @"oglFlip";//不管subType is "fromLeft" or "fromRight",official只有一种效果
animation.type = @"rippleEffect";
animation.type = @"pageCurl";
animation.type = @"pageUnCurl"
animation.type = @"cameraIrisHollowOpen ";
animation.type = @"cameraIrisHollowClose ";
2.3 CATransition的 startProgress endProgress属性
可以控制动画进行的过程,可以让动画停留在某个动画点上,值在0.0到1.0之间。endProgress要大于等于startProgress。
[UIView animateWithDuration:1 delay:0 options:UIViewAnimationOptionRepeat animations:^{
//view变透明
} completion:^(BOOL finished) {
[UIView animateWithDuration:1 delay:0 options:UIViewAnimationOptionRepeat animations:^{
//view恢复回来
} completion:^(BOOL finished) {
}];
}];