我用CAShapeLayer創建了一個圓。我想在修復中心旋轉這個圓。我正在使用以下代碼進行動畫製作。使用這個代碼圓是旋轉的,但不是在修復中心。中心不斷變化。我不希望這種情況發生。在特定中心旋轉圓圈
這是我的動畫代碼
CABasicAnimation* rotationAnimation;
rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI * 2.0 * rotations * 2.0 ];
rotationAnimation.duration = 10.0; // rotationAnimation.cumulative = YES;
rotationAnimation.repeatCount = 1.0;
rotationAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];
[circle1 addAnimation:rotationAnimation forKey:@"rotationAnimation"];
感謝
[circle1 setAnchorPoint:(0.5,0.5)];這將保持它在裏面。 – BhushanVU 2013-03-05 11:13:03