#import "ViewController.h"
@interface ViewController ()
//连线yellowView
@property (weak, nonatomic) IBOutlet UIView *yellowView;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
//UIView 的动画效果: 在view的形变中加入过渡效果
}
// 连线普通动画
- (IBAction)normalAnimation:(id)sender {
//1.开启动画
[UIView beginAnimations:@"normal" context:nil];
//2.设置动画的相关属性
//代理
[UIView setAnimationDelegate:self];
//持续时间:决定动画速度
[UIView setAnimationDuration:10];
//重复次数
// [UIView setAnimationRepeatCount:2];
//加速方式
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
//动画效果
_yellowView.transform = CGAffineTransformRotate(_yellowView.transform, M_PI);
//提交动画
[UIView commitAnimations];
}
//连线Block动画
- (IBAction)blockAnimation:(id)sender {
[UIView animateWithDuration:1 animations:^{
_yellowView.transform = CGAffineTransformRotate(_yellowView.transform, M_PI);
}completion:^(BOOL finished) {
NSLog(@"动画完成时调用的代码");
}];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
屏幕快照 2016-02-24 上午10.50.02.png