码迷,mamicode.com
首页 > 其他好文 > 详细

coreAnimation核心动画(四)CAAnimationGroup

时间:2015-11-22 15:59:57      阅读:119      评论:0      收藏:0      [点我收藏+]

标签:

技术分享技术分享

 

 1 //
 2 //  ViewController.m
 3 //  CAAnimationGroup
 4 //
 5 //  Created by ys on 15/11/22.
 6 //  Copyright (c) 2015年 ys. All rights reserved.
 7 //
 8 
 9 #import "ViewController.h"
10 
11 @interface ViewController ()
12 @property (weak, nonatomic) IBOutlet UIView *redView;
13 
14 @end
15 
16 @implementation ViewController
17 
18 - (void)viewDidLoad {
19     [super viewDidLoad];
20 }
21 
22 -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
23 {
24     //创建旋转动画对象
25     CABasicAnimation *rotate = [CABasicAnimation animation];
26     rotate.keyPath = @"transform.rotation";
27     rotate.toValue = @(M_PI_2);
28     //创建缩放动画对象
29     CABasicAnimation *scale = [CABasicAnimation animation];
30     scale.keyPath = @"transform.scale";
31     scale.toValue = @(0.0);
32     //创建平移动画对象
33     CABasicAnimation *move = [CABasicAnimation animation];
34     move.keyPath = @"transform.translation";
35     move.toValue = [NSValue valueWithCGPoint:CGPointMake(200, 200)];
36     //创建动画对象组
37     CAAnimationGroup *group = [CAAnimationGroup animation];
38     group.animations = @[rotate,scale,move];
39     group.duration = 11.5;
40     group.removedOnCompletion = NO;
41     group.fillMode = kCAFillModeForwards;
42     
43     [self.redView.layer addAnimation:group forKey:nil];
44 
45 }
46 
47 @end

 

coreAnimation核心动画(四)CAAnimationGroup

标签:

原文地址:http://www.cnblogs.com/yangshun-work/p/4985895.html

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