Search code examples
iphonecore-animationcalayercabasicanimation

Is there a way to set the number of animation steps for CABasicAnimation?


I want to create an animation that interpolates some property for 2 seconds and only 20 frames (presentation layers) have to be generated by the CoreAnimation framework. I know how to provide a duration for the explicit animation but which property do I have to change in order to get particular number of frames calculated by interpolation process?

Thanks in advance.


Solution

  • Core Animation works by using interpolation--calculating intermediate values in between key values you specify. If it's a keyframe animation, it interpolates between the number (n) of values in your values array. If it's a basic animation, it interpolates between two values--your start and end values. If you just want to change the frame rate of the animation instance go through this How to change the frame rate of a core animation instance?