I have an ball image that I'm animating around a path. The animation is set to repeat forever, but why is there a delay between repeats?
Here's my code:
CGPathRef aPath;
aPath = CGPathCreateWithEllipseInRect(CGRectMake(0, 0, SIZE, SIZE), NULL);
[CATransaction begin];
arcAnimation = [CAKeyframeAnimation animationWithKeyPath: @"position"];
[arcAnimation setBeginTime:CACurrentMediaTime()];
[arcAnimation setDuration: 1.5];
[arcAnimation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]];
[arcAnimation setAutoreverses: NO];
[arcAnimation setRepeatCount:HUGE_VALF];
arcAnimation.removedOnCompletion = NO;
arcAnimation.fillMode = kCAFillModeRemoved;
[arcAnimation setPath: aPath];
[ball.layer addAnimation: arcAnimation forKey: @"position"];
[CATransaction commit];
CFRelease(aPath);
Try this:
[animation setCalculationMode:kCAAnimationPaced]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With