coreAnimation核心动画(四)CAAnimationGroup

 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
时间: 2024-08-03 22:51:29

coreAnimation核心动画(四)CAAnimationGroup的相关文章

核心动画 (CAAnimationGroup)

Main.storyboard ViewController.m // //  ViewController.m //  8A05.核心动画 CAAnimationGroup // //  Created by huan on 16/2/5. //  Copyright © 2016年 huanxi. All rights reserved. // #import "ViewController.h" @interface ViewController () @property (we

CoreAnimation 核心动画

- (void)createBaseAnimation{ //基础动画 CABasicAnimation *animation = [CABasicAnimation animation]; animation.keyPath = @"bounds"; //    animation.fromValue = [NSValue valueWithCGRect:CGRectMake(0, 0, 300, 300)];//默认为现在的状态 animation.toValue = [NSVal

核心动画之CAAnimationGroup动画组和CATransition 转场动画以及UIView的转场动画

1.动画组,是CAAnimation的子类,可以保存一组动画对象,将CAAnimationGroup 对象加入层后,组中所有动画对象可以同时并发运行 1.1属性说明: animations:用来保存一组动画对象的NSArray ·默认情况下,一组动画对象是同时运行的,也可以通过设置动画对象的beginTime属性来更改动画的开始时间. -(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{ // 

coreAnimation核心动画(一)CABasicAnimation

2 1 // 2 // ViewController.m 3 // coreAnimation 4 // 5 // Created by ys on 15/11/21. 6 // Copyright (c) 2015年 ys. All rights reserved. 7 // 8 9 #import "ViewController.h" 10 11 @interface ViewController () 12 @property (nonatomic,strong)CALayer

iOS CoreAnimation(核心动画二)

CATransition :转场动画  翻转动画 @interface ViewController () - (IBAction)previous:(UIButton *)sender; - (IBAction)next:(UIButton *)sender; @property (strong, nonatomic) IBOutlet UIImageView *iconView; @property(nonatomic,assign)int index;//当前图片的索引 @property

ios(CoreAnimation核心动画 一) CABasicAnimation动画与锚点

一.position和anchorPoint position:用来设置CALayer在父层中的位置,以父层的左上角为原点(0, 0) anchorPoint(锚点): 称为"定位点"."锚点" 决定着CALayer身上的哪个点会在position属性所指的位置 以自己的左上角为原点(0, 0) 它的x.y取值范围都是0~1,默认值为(0.5, 0.5) 推荐一个连接:http://www.cnblogs.com/wendingding/p/3800736.html

ios(CoreAnimation核心动画 ) CABasicAnimation动画与锚点

一.position和anchorPoint position:用来设置CALayer在父层中的位置,以父层的左上角为原点(0, 0) anchorPoint(锚点): 称为“定位点”.“锚点” 决定着CALayer身上的哪个点会在position属性所指的位置 以自己的左上角为原点(0, 0) 它的x.y取值范围都是0~1,默认值为(0.5, 0.5) 推荐一个连接:http://www.cnblogs.com/wendingding/p/3800736.html讲的非常详细,而且有图视,默认

CoreAnimation 核心动画 的一些常用属性 和 方法

1.常用属性: frame   bounds   center   alpha    Transition 过渡    transform 动画效果 2.常用方法: +(void)setAnimationDelegate:(id)delegate; +(void)setAnimationWillStartSelector:(SEL)selector; 当动画结束的时候,执行delegate对象的selector,并且把beginAnimations:context:中传入的参数传进selecto

CoreAnimation 核心动画二 锚点

锚点: anchorPoint     以锚点为中心 执行动画 (与 渔夫固定船的点时一致的) anchorPoint 默认是 0.5,0.5  (注意: 锚点 是一个比例) anchorPoint 在左上角的时候 为 0,0 anchorPoint 在右上角的时候 为 1,0 anchorPoint 在左下角的时候 为 0,1 anchorPoint 在右下角的时候 为 1,1 1 #import "ViewController.h" 2 3 @interface ViewContr