0
究竟是0到1这个东西是什么?例如,我怎样才能将图层完全旋转到170度?如何将此视图旋转到弧度或度数的特定值?
CALayer* viewLayer = myView.layer;
CABasicAnimation* animation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
animation.fromValue = [NSNumber numberWithFloat:0.0 * M_PI];
animation.toValue = [NSNumber numberWithFloat:1.0 * M_PI];
animation.duration = 1.0;
animation.cumulative = YES;
animation.repeatCount = 2;
animation.removedOnCompletion = NO;
animation.fillMode = kCAFillModeForwards;
[viewLayer addAnimation:animation forKey:@"transform.rotation.z"];
0 * PI = 0度。 1 * PI = 180度 – Toad 2010-02-02 13:27:16