double radians(double degrees) {
return ( degrees * 3.14159265 ) / 180.0;
}
//这里的旋转与anchor有关系,不同的anchor有不同的旋转轴
CABasicAnimation *animation = [ CABasicAnimation
animationWithKeyPath: @"transform" ];
animation.toValue =[ NSValue valueWithCATransform3D: CATransform3DMakeRotation(radians(90.0), 0, 1, 0) ];
animation.cumulative=YES;
animation.duration = 1.5;
animation.timingFunction = [CAMediaTimingFunction functionWithName: kCAMediaTimingFunctionEaseInEaseOut];
[animation setFillMode:kCAFillModeForwards];
[animation setRemovedOnCompletion:NO];
[testView.layer addAnimation: animation forKey: @"animation" ];