360 旋转
2015-12-30 21:04
330 查看
- (void)rotateSpinningView
{
[UIView animateWithDuration:1.5 delay:0 options:UIViewAnimationOptionCurveLinear animations:^{
self.imageView.transform = CGAffineTransformRotate(self.imageView.transform, M_PI);
} completion:^(BOOL finished) {
[self rotateSpinningView];
}];
}
- (void) runSpinAnimationOnView:(UIView*)view duration:(CGFloat)duration rotations:(CGFloat)rotations repeat:(float)repeat;
{
CABasicAnimation* rotationAnimation;
rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI * 2.0 /* full rotation*/ * rotations * duration ];
rotationAnimation.duration = duration;
rotationAnimation.cumulative = YES;
rotationAnimation.repeatCount = repeat;
[view.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"];
}
{
[UIView animateWithDuration:1.5 delay:0 options:UIViewAnimationOptionCurveLinear animations:^{
self.imageView.transform = CGAffineTransformRotate(self.imageView.transform, M_PI);
} completion:^(BOOL finished) {
[self rotateSpinningView];
}];
}
- (void) runSpinAnimationOnView:(UIView*)view duration:(CGFloat)duration rotations:(CGFloat)rotations repeat:(float)repeat;
{
CABasicAnimation* rotationAnimation;
rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI * 2.0 /* full rotation*/ * rotations * duration ];
rotationAnimation.duration = duration;
rotationAnimation.cumulative = YES;
rotationAnimation.repeatCount = repeat;
[view.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"];
}
相关文章推荐
- poj 2409(polya定理模板)
- QT怎样在QTableWidge显示图片
- [二]Ajax基本实现
- 标签分类
- 记录我的前端之路
- 【每日一剂】---onSaveInstanceState()保存临时数据
- 如何改变<input type=”text" >输入框内的值
- HDU 2019
- 大数据成长历程
- 使用fstream输出数据到.txt文件
- 12月30号 iOS程序准备
- 读取注册表hive文件
- 深入分析JavaWeb Item40 -- 文件上传和下载
- linux下串口调试工具/串口终端推荐: picocom
- mac 中npm安装模块去除sudo
- C语言的判断语句
- [nginx+tomcat的负载均衡搭建] This system is not registered with RHN
- Brocade SAN Switch CFG backup and recover
- Codeforce 题目479E Riding in a Lift(DP)
- Java中的String为什么是不可变的? -- String源码分析