CABasicAnimation* rotationAnimation;
rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
rotationAnimation.toValue = [NSNumber numberWithFloat:angle*M_PI ];//一共转多少2pi为一圈
rotationAnimation.duration = 5.0f;//转多少秒
rotationAnimation.cumulative = YES;
rotationAnimation.delegate = self;
rotationAnimation.fillMode=kCAFillModeForwards;
rotationAnimation.removedOnCompletion = NO;
rotationAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];//轨迹函数,先慢再快再慢
[_zhuanpan.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"];
rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
rotationAnimation.toValue = [NSNumber numberWithFloat:angle*M_PI ];//一共转多少2pi为一圈
rotationAnimation.duration = 5.0f;//转多少秒
rotationAnimation.cumulative = YES;
rotationAnimation.delegate = self;
rotationAnimation.fillMode=kCAFillModeForwards;
rotationAnimation.removedOnCompletion = NO;
rotationAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];//轨迹函数,先慢再快再慢
[_zhuanpan.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"];