//
// ViewController.m
// 组动画 CAAnimationGroup
//
// Created by 陆巧怡 on 15/7/31.
// Copyright (c) 2015年 Simon. All rights reserved.
//
#import "ViewController.h"
@interface ViewController ()
@property (strong, nonatomic) IBOutlet UIImageView *imageView;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
//平移动画
CABasicAnimation *moveAnima = [CABasicAnimation animation];
moveAnima.keyPath = @"transform.translation.y";
moveAnima.toValue = @(100);
//缩放缩放
CABasicAnimation *scaleAnima = [CABasicAnimation animation];
scaleAnima.keyPath = @"transform.scale";
scaleAnima.toValue = @(0.0);
//旋转动画
CABasicAnimation *rotationAnima = [CABasicAnimation animation];
rotationAnima.keyPath = @"transform.rotation";
rotationAnima.toValue = @(M_PI_2);
//组动画
CAAnimationGroup *groupAnima = [CAAnimationGroup animation];
groupAnima.duration = 3.0;
groupAnima.animations = @[moveAnima,scaleAnima,rotationAnima];
[self.imageView.layer addAnimation:groupAnima forKey:nil];
}
@end
组动画 CAAnimationGroup
最新推荐文章于 2016-06-21 10:02:51 发布