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

ios核心动画之图片抖动

时间:2016-01-24 12:52:38      阅读:185      评论:0      收藏:0      [点我收藏+]

标签:

 1 #import "NJViewController.h"
 2 
 3 #define angle2Radian(angle) ((angle) / 180.0 * M_PI)
 4 
 5 @interface NJViewController ()
 6 
 7 @property (weak, nonatomic) IBOutlet UIImageView *iconView;
 8 @end
 9 
10 @implementation NJViewController
11 
12 - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
13 {
14     // 1.创建核心动画
15     CAKeyframeAnimation  *keyAnima = [CAKeyframeAnimation animation];
16     keyAnima.keyPath = @"transform.rotation";
17     // 度数 / 180 * M_PI
18     keyAnima.values = @[@(-angle2Radian(4)), @(angle2Radian(4)), @(-angle2Radian(4))];
19 
20     keyAnima.removedOnCompletion = NO;
21     keyAnima.fillMode = kCAFillModeForwards;
22     keyAnima.duration = 0.1;
23     
24     // 设置动画重复的次数
25     keyAnima.repeatCount = MAXFLOAT;
26     
27     // 2.添加核心动画
28     [self.iconView.layer addAnimation:keyAnima forKey:nil];
29 }
30 
31 @end

 

ios核心动画之图片抖动

标签:

原文地址:http://www.cnblogs.com/PJHome/p/5154874.html

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