最近做一个图片旋转的动画,留个笔记吧。
UIImageView *imageView;
CABasicAnimation* rotationAnimation;
rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI * 2.0 ];
rotationAnimation.duration = 1.0;
rotationAnimation.cumulative = YES;
rotationAnimation.repeatCount = 2;//HUGE_VALF;
[imageView.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"];