您的位置:首页 > 其它

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"];

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: