我正在使用跟随 CGPathAddEllipseInRect 的 CAKeyframeAnimation 沿圆圈为 UIView 设置动画。但是,无论视图最初位于哪个框架中,视图似乎总是从同一个位置开始。有什么方法可以调整路径上视图的起始位置吗?
谢谢!
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"];