Chapter 8

Animating Your Graphics

What You Will Learn In This Chapter:

  • Animating a sequence of images with UIImageView
  • Learning the basic uses for Core Animation
  • Exploring the use of blocks in Objective-C
  • Animating UIViews
  • Using Core Animation layers
  • Building a game by using property and transition animations

One of the most important things in just about any game is animation. Earlier in the book, you learned how to animate your games based on the display refresh rate using the CADisplayLink class. Using this class, you updated the position of the objects in your game based on the time since the previous update. In this chapter, you will explore two other animation methods.

First, you will look at animating individual sprites by using the UIImageView class. You may recall using UIImageView in the Blocker game to display the ball and paddle. Along with displaying static images, you can use the UIImageView to animate a series of images. You provide an array of images to the image view, set up the animation duration, and tell it to start animating. Then, the image view displays each of the images in the array for the total duration that you provide to perform animation.

After you finish with UIImageView, you will concentrate on learning Core Animation. Using this API, you can build very complex animations. You can use Core Animation to animate changes to many properties of your views and to animate the transition between views.

Animating Images with UIImageView

As you may recall ...

Get Beginning iOS Game Development now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.