I have a CAAnimation that uses a timing function. I need callbacks to happen consistently thought the animation. Similar to jQuery's step callback. I have scoured the internet for a solution to this but have not been able to find one. (maybe I am not searching correctly)
My code thus far:
CABasicAnimation *rotationAnimation;
rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
rotationAnimation.toValue = [NSNumber numberWithFloat:rotation / 180.0 * M_PI];
rotationAnimation.duration = duration;
rotationAnimation.repeatCount = 0;
rotationAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];
[_image.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"];
I know the delegate has these two methods:
ā animationDidStart:
ā animationDidStop:finished:
It would be nice if there was a way to create a category to implement an
- animationProgress:
Or something similar. Or maybe CAAnimations aren't the solution.
How can I achieve this with CAAnimations or any alternative?