我沿着圓圈使用遵循CGPathAddEllipseInRect一個CAKeyframeAnimation動畫一個UIView。然而,視圖始終似乎始於同一個地方,無論它最初放置在哪個框架中。是否有某種方法可以調整路徑上視圖的起始位置?設置起始點CGAffineTransform
謝謝!
CAKeyframeAnimation *myAnimation = [CAKeyframeAnimation animationWithKeyPath:@"position"];
myAnimation.fillMode = kCAFillModeForwards;
myAnimation.repeatCount = 5;
myAnimation.calculationMode = kCAAnimationPaced;
myAnimation.duration = 10.0;
CGMutablePathRef animationPath = CGPathCreateMutable();
CGPathAddEllipseInRect(animationPath, NULL, rect);
myAnimation.path = animationPath;
CGPathRelease(animationPath);
[view.layer addAnimation:myAnimation forKey:@"changeViewLocation"];