Reputation: 5
i want to create a frame-by-frame animation with an array of images.
There is to set the animationDuration
, the standard value is 1.
Can i be sure that it is always 30fps on every iOS-device when i start the animation with startAnimating
?
So i need exactly 15 images for a 1 second animation - is there a special calculation i can use when i have more or less than 15 images that have to be animated in exactly one second?
E.g. 60/15*(count number of images in array)
Upvotes: 0
Views: 1585
Reputation: 69037
I don't think you can count on UIImageView
animationImages
to give you 30FPS everywhere and everytime.
Indeed, this is meant for very simple and "opportunistic" animations. If you google for it, you will find reports of that method hogging a device (in specific conditions). On the other hand, if your images are small, then chances are that it could work, but you get no guarantees (nor ways to enforce the FPS you need).
So i need exactly 15 images for a 1 second animation - is there a special calculation i can use when i have more or less than 15 images that have to be animated in exactly one second?
If I understand your question right, then you can try with:
duration = number_of_images / FPS; // e.g., 60 images / 30 FPS = 2 seconds
of course, if the device will then show properly the 60 images at 30 FPS is another story.
Upvotes: 2