Sign F is correct. I had a similar problem while working on a game. I wanted to restart the animation from the point at which they were paused.
The simplest solution I could come up with was to fix the start time:
mStartTime = [layer convertTime:CACurrentMediaTime() fromLayer:nil];
Then, when the animation is stopped, get the stop time and calculate the offset:
CFTimeInterval stopTime = [layer convertTime:CACurrentMediaTime() fromLayer:nil];; mTimeOffset += stopTime - mStartTime;
Using mTimeOffset , I would calculate a different set of key times:
- (NSArray *)keyTimesWithOffsetTime:(CFTimeInterval)offsetTime;
Based on this, I would get a different starting frame for the animation. By "frame" I mean any segment of keyframe animation.
This is a little pain, but it works. I would be very interested to know how games using cocos2d handle pause and resume. There should be an easier way.
As for the animation along the way, it seems that everything is fine with you. If not, look at this tutorial:
Main animation: paths
source share