Reputation: 22559
I wrote some code for a Mac (Cocoa) App, where the animations are smooth and lovely. However, I copied it as it is to the iOS project, and ran it on "The New iPad", the resolutionary thingy, and for some reason the layers animation is jagged. The layer suddenly moves a few pixels up, then stops for a sec, then suddenly popes up a few more pixels, it is like a very low frame rate animation).
Interestingly, running the same code on the old iPad 1 gave smooth results!! x( .. made me realize it's a retina display problem.
I am doing a faint (slow) animation, not moving the layers around much. (Example, moving a layer.position.x 10 pixels over a period of 9.1 sec. This gives us a hint that the layer is not interpolating the 0.x pixels?)
I tried increasing the speed (reducing the duration) by four, and it is animating without problems. :/ but, faint animations (slow) have problems..
Any Ideas?
If my question is vague, this might help:
move a layer 10 pixels over 10 sec duration. On the iPad, it looks great (60 FPS presumably).
On the new iPad (retina), it is as if it's 10 FPS (or something like that) !!.
Upvotes: 1
Views: 715
Reputation: 22559
To animate properly on Retina screens, an extra line of code was missing .. >.<
if ([subLayer respondsToSelector:@selector(setContentsScale:)]) {
subLayer.contentsScale = [[UIScreen mainScreen] scale];
}
From this awesome guy: Retina display core graphics font quality
(I don't think I should close the question, since this title is more appropriate, as it addresses all retina issues with core animation).
Upvotes: 6