码迷,mamicode.com
首页 > 移动开发 > 详细

ios开发——实用技术篇&三维旋转动画

时间:2015-05-30 23:53:43      阅读:226      评论:0      收藏:0      [点我收藏+]

标签:

三维旋转动画

 

实现三位旋转动画的方法有很多种,这里介绍三种

一:UIView

1     [UIView animateWithDuration:1.0 animations:^{
2         self.iconView.layer.transform = CATransform3DMakeRotation(M_PI_2, 0, 1, 0);
3     } completion:^(BOOL finished) {
4         self.iconView.image = [UIImage imageNamed:@"user_defaultgift"];
5        
6         [UIView animateWithDuration:1.0 animations:^{
7             self.iconView.layer.transform = CATransform3DMakeRotation(M_PI, 0, 1, 0);
8         }];
9     }];

二:CATransition自定义

1     CATransition
2     CATransition *anim = [CATransition animation];
3     anim.duration = 1.0;
4     anim.type = @"rippleEffect";
5     [self.iconView.layer addAnimation:anim forKey:nil];

三:CATransition

 1     
 2     [UIView transitionWithView:self.iconView duration:1.0 options:UIViewAnimationOptionTransitionFlipFromLeft animations:^{
 3         self.iconView.image = [UIImage imageNamed:@"user_defaultgift"];
 4     } completion:^(BOOL finished) {
 5         dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
 6             [UIView transitionWithView:self.iconView duration:1.0 options:UIViewAnimationOptionTransitionFlipFromRight animations:^{
 7                 self.iconView.image = [UIImage imageNamed:@"default_avatar"];
 8             } completion:nil];
 9         });
10     }];
11 }

 

 
 
 

ios开发——实用技术篇&三维旋转动画

标签:

原文地址:http://www.cnblogs.com/iCocos/p/4541205.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!