CATransition的type属性
1.#define定义的常量
kCATransitionFade 交叉淡化过渡
kCATransitionMoveIn 新视图移到旧视图上面
kCATransitionPush 新视图把旧视图推出去
kCATransitionReveal 将旧视图移开,显示下面的新视图
2.用字符串表示
pageCurl 向上翻1页
pageUnCurl 向下翻1页
rippleEffect 滴水效果
suckEffect 收缩效果,如1块布被抽走
cube 立方体效果
oglFlip 上下翻转效果
- (void)MyCAnimation1 {
CATransition *animation = [CATransition animation];
//动画时间
animation.duration = 1.0f;
//display mode, slow at beginning and end
animation.timingFunction = UIViewAnimationCurveEaseInOut;
//过渡效果
animation.type = kCATransitionMoveIn;
//过渡方向
animation.subtype = kCATransitionFromTop;
//添加动画
[imageView.layer addAnimation:animation forKey:nil];
}
- (void)MyCAnimation2 {
CATransition *animation = [CATransition animation];
//动画时间
animation.duration = 1.0f;
//display mode, slow at beginning and end
animation.timingFunction = UIViewAnimationCurveEaseInOut;
//在动画履行完时是不是被移除
animation.removedOnCompletion = NO;
//过渡效果
animation.type = @"pageCurl";
//过渡方向
animation.subtype = kCATransitionFromRight;
//暂时不知,感觉与Progress1起用的,如果不加,Progress好像没有效果
animation.fillMode = kCAFillModeForwards;
//动画停止(在整体动画的百分比).
animation.endProgress = 0.7;
[imageView.layer addAnimation:animation forKey:nil];
}
- (void)MyCAnimation3 {
CATransition *animation = [CATransition animation];
//动画时间
animation.duration = 1.0f;
//display mode, slow at beginning and end
animation.timingFunction = UIViewAnimationCurveEaseInOut;
//过渡效果
animation.type = @"pageUnCurl";
//过渡方向
animation.subtype = kCATransitionFromRight;
//暂时不知,感觉与Progress1起用的,如果不加,Progress好像没有效果
animation.fillMode = kCAFillModeBackwards;
//动画开始(在整体动画的百分比).
animation.startProgress = 0.3;
[imageView.layer addAnimation:animation forKey:nil];
}