0

In my code I create a CAKeyframeanimation with an infinite repeat count, add it to a specific CALayer. I would like to modify the duration (= the speed) of the animation while animating, without the need of restarting my animation. So when i click on a button, i get a duration that I can set for the animation. I have to remove the animation, create another one, and make it start to where i stopped it. The problem is that I can't seem to restart it from that point without making it loop from that point. If it were a rotation, it wouldn't be problematic but I use a translation.


So, I have 3 points, A, then B, then C, on a straight line. My translation goes from A to C, passing through B, and repeats itself infinitely. When i change the duration, at point B, I can only recreate a translation animation from B to C (which is not good), Or, i can recreate an animation from A to C with the new duration but it restarts from point A (which is no good either). Would you have any idea of how i can do what i want ? Thanks

Plot
  • 898
  • 2
  • 15
  • 26
  • Is point B always the same point, or is it based on some user input (like pause) that will start from some arbitrary point between A and C? I guess I'm asking what is the inherent problem you are trying to solve at a higher level? Or are you _only_ wanting to change the speed of the animation? – larsacus Nov 08 '12 at 15:31
  • B is an arbitrary point. But I managed to solve my problem using animation block. I used to have issues with animation callbacks. Using blocks did it for me ! :) – Plot Nov 08 '12 at 16:11

0 Answers0