I am working on an iPad application that animates on very large images (full-screen images that can be magnified by 2x and still be retina quality). I spent a lot of time getting smooth transitions when zooming and panning. However, when starting the application on iOS7 animations become very jerky (slow frame rate).
Further testing shows that the zoom animation causes a problem (panning does not cause a problem). Interestingly, I was able to fix this by setting alpha for the scalable image to 0.995 (instead of 1.0 ).
I have two questions
- What has changed in
iOS7 to make this happen? - Why does changing transparency of a view matter?
Additional information on the above issues:
Animation Setup
Animations are all predefined and played back when interacting with the user. Animation is a combination of panning and zooming. The animation is very simple:
[UIView animateWithDuration:animationDuration delay:animationDelay options:UIViewAnimationOptionCurveEaseInOut animations:^{ self.frame = nextFrame;
To fix jerky animation, I set alpha before animation
self.alpha = 0.99;
Some interesting points:
- Setting
alpha inside animation also works - Setting
alpha back to 1.0 after the animation, and then performing inverse animation with 1.0 alpha does not give smooth inverse animation.
Opacity
I previously used opacity correction to make the animation smooth while zooming and panning multiple images. For example, I had two large images, panning and zooming at different speeds with one on top of the other. When the previously uncorrected part of the lower image (the image below) began to be displayed, the animation will become a jerk (panning as well as zooming). My thought about why alpha helps in this case is that if the top image has a bit of transparency, the bottom image should always be displayed, which means that it can be cached before the animation happens. This idea is supported by doing reverse animation and not seeing jerky animation. (Probably, I would be interested to know if anyone has different thoughts on this).
Having said the above, I do not know how this will affect when there will be only one image (as in the situation that I describe in my question). In particular, when after receiving jerky animation, the reverse animation is still twitching. Another point of difference between the two situations is that only zooming causes the problem in the current problem, while in the double-image problem it is panning as well as zooming.
Hope the foregoing is clear - any ideas appreciated.
objective-c ios6 ios7 ipad core-animation
lindon fox
source share