UIViewAnimation动画与Core Animation的CATransition类动画
2011-09-27 21:06
323 查看
1.使用UIView类函数实现:
//UIViewAnimationTransitionFlipFromLeft, 向左转动
//UIViewAnimationTransitionFlipFromRight, 向右转动
//UIViewAnimationTransitionCurlUp, 向上翻动
//UIViewAnimationTransitionCurlDown, 向下翻动
[UIView beginAnimations:@"animationID" context:nil];
[UIView setAnimationDuration:0.5f]; //动画时长
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition: UIViewAnimationTransitionFlipFromLeft forView:self.view cache:YES]; //给视图添加过渡效果
//在这里写你的代码.
[UIView commitAnimations]; //提交动画
2.使用CATransition对象来实现:
CATransition比较强大,一般可以使用CATransition模拟UIView的动画。
/* 过渡效果
fade //交叉淡化过渡(不支持过渡方向)
push //新视图把旧视图推出去
moveIn //新视图移到旧视图上面
reveal //将旧视图移开,显示下面的新视图
cube //立方体翻滚效果
oglFlip //上下左右翻转效果
suckEffect //收缩效果,如一块布被抽走(不支持过渡方向)
rippleEffect //滴水效果(不支持过渡方向)
pageCurl //向上翻页效果
pageUnCurl //向下翻页效果
cameraIrisHollowOpen //相机镜头打开效果(不支持过渡方向)
cameraIrisHollowClose //相机镜头关上效果(不支持过渡方向)
*/
/* 过渡方向
fromRight;
fromLeft;
fromTop;
fromBottom;
*/
CATransition *animation = [CATransition animation];
animation.delegate = self;
animation.duration = 0.5f; //动画时长
animation.timingFunction = UIViewAnimationCurveEaseInOut;
animation.fillMode = kCAFillModeForwards;
animation.type = @"cube"; //过度效果
animation.subtype = @"formLeft"; //过渡方向
animation.startProgress = 0.0 //动画开始起点(在整体动画的百分比)
animation.endProgress = 1.0; //动画停止终点(在整体动画的百分比)
animation.removedOnCompletion = NO;
[self.view.layer addAnimation:animation forKey:@"animation"];
参考 http://www.devdiv.com/home.php?mod=space&uid=8639&do=blog&id=4143
//UIViewAnimationTransitionFlipFromLeft, 向左转动
//UIViewAnimationTransitionFlipFromRight, 向右转动
//UIViewAnimationTransitionCurlUp, 向上翻动
//UIViewAnimationTransitionCurlDown, 向下翻动
[UIView beginAnimations:@"animationID" context:nil];
[UIView setAnimationDuration:0.5f]; //动画时长
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition: UIViewAnimationTransitionFlipFromLeft forView:self.view cache:YES]; //给视图添加过渡效果
//在这里写你的代码.
[UIView commitAnimations]; //提交动画
2.使用CATransition对象来实现:
CATransition比较强大,一般可以使用CATransition模拟UIView的动画。
/* 过渡效果
fade //交叉淡化过渡(不支持过渡方向)
push //新视图把旧视图推出去
moveIn //新视图移到旧视图上面
reveal //将旧视图移开,显示下面的新视图
cube //立方体翻滚效果
oglFlip //上下左右翻转效果
suckEffect //收缩效果,如一块布被抽走(不支持过渡方向)
rippleEffect //滴水效果(不支持过渡方向)
pageCurl //向上翻页效果
pageUnCurl //向下翻页效果
cameraIrisHollowOpen //相机镜头打开效果(不支持过渡方向)
cameraIrisHollowClose //相机镜头关上效果(不支持过渡方向)
*/
/* 过渡方向
fromRight;
fromLeft;
fromTop;
fromBottom;
*/
CATransition *animation = [CATransition animation];
animation.delegate = self;
animation.duration = 0.5f; //动画时长
animation.timingFunction = UIViewAnimationCurveEaseInOut;
animation.fillMode = kCAFillModeForwards;
animation.type = @"cube"; //过度效果
animation.subtype = @"formLeft"; //过渡方向
animation.startProgress = 0.0 //动画开始起点(在整体动画的百分比)
animation.endProgress = 1.0; //动画停止终点(在整体动画的百分比)
animation.removedOnCompletion = NO;
[self.view.layer addAnimation:animation forKey:@"animation"];
参考 http://www.devdiv.com/home.php?mod=space&uid=8639&do=blog&id=4143
相关文章推荐
- ios-day18-11(使用CAAnimationGroup实现对UIView的组合动画)
- swift2.0 CASpringAnimation 和 UIView.animateWithDuration 分别实现弹性动画
- 旋转动画 uiview animation rotate
- 自定义push viewcontroll 的动画 (Custom animation for pushing a UIViewController)
- UIView动画animation
- ios之UIView执行基础动画Animation使用参数配置
- Core Animation - 属性动画CAPropertyAnimation
- UIView下使用Animation控制动画
- UIViewAnimation动画与Core Animation的CATransition类动画
- UIViewAnimationWithBlocks动画之spring
- UIView动画animation 水平移动UILabel
- UIView下使用Animation控制动画
- UIView动画与core animation之间的关系
- iOS UIView animation动画效果 (1)
- iOS 动画Animation详解, UIView动画(UIView属性动画,UIViewTransition动画,UIView Block动画),CALayer动画(CABasicAnima...)
- UIViewAnimation动画与Core Animation的CATransition类动画
- iOS 动画Animation详解, UIView动画,CALayer动画
- iOS开发-CALayer/Core Animation/UIView动画封装
- iOS-CAAnimation & UIView动画
- UIViewAnimation动画与Core Animation的CATransition类动画