CABasicAnimation 实现的几种常用的简单动画
不断旋转
-(void)setImageRote:(UIImageView *)imageView andAngel:(float)angel andTime:(float)time
{
NSLog(@"开始旋转");
CABasicAnimation* rotationAnimation;
rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
rotationAnimation.toValue = [NSNumber numberWithFloat: angel];
rotationAnimation.duration =time;
rotationAnimation.cumulative =YES;
rotationAnimation.repeatCount =MAXFLOAT;
[imageView.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"];
}
不断放大缩小
-(void)setImage:(UIImageView *)imageView scale:(CGFloat) scale andDuration:(CGFloat)time
{
CABasicAnimation *scaleAnimation = [CABasicAnimation animationWithKeyPath:@"transform.sc