On iOS, how can smooth animation be achieved?

Is it true that for Angry Birds or Cut the Rope they first draw the entire frame of the entire screen (entire view) and then draw the entire frame on the screen, making the animation smooth?

This is because if we animate a 20 x 20 pixel metal ball, and if we first remove the ball and then draw the ball in a new place, then there may be some flicker very subtle, but noticeable.

Can it be the same if it is animated with a help drawRectthat removes the entire screen and then draws everything in its new locations, which may be even more flickering than higher?

Returning to the method of drawing the entire frame: if the ball was at the coordinate (100 100), and now the ball is painted over the entire screenshot (with a new background), at coordinates (103, 100), then this is very invisible to the changes. (does not disappear, and then reappears).

How do you get smooth animations that look like Angry Birds or Cut the Rope?

+3
source share
3 answers

They use OpenGL, which is much faster than any of the quartz methods (i.e. drawRect), since it uses the GPU instead of the CPU for rendering. Using quartz can be hundreds or thousands of times slower depending on what you are doing for sure.

OpenGL. UIView, . , . , , .

+4

CALayers. , .

+1

OpenGL, , . , , , .

+1

All Articles