Graphics Programs Reference
In-Depth Information
22
Core Animation Layer
Animation is a hallmark of the iOS interface. When used properly, it gives the user visual
cues about the application's workflow. The classes and functions needed to animate an ap-
plication's interface are in the Core Animation API. To use any part of Core Animation,
you need to add the QuartzCore framework to your project.
Open your
HypnoTime
project and select the project from the project navigator. Then, se-
lect the
HypnoTime
target and the
Build Phases
pane. Add
QuartzCore.framework
to
Link Binary With Libraries
, as shown in
Figure 22.1
.
Figure 22.1 QuartzCore.framework
There are two classes that make Core Animation work:
CALayer
and
CAAnimation
.
At its core, an instance of
CALayer
is a buffer containing a bitmap. When you draw a lay-
er (or a stack of layers), the rendering is hardware-accelerated. This makes drawing a layer
to the screen incredibly fast. Like views, layers are arranged hierarchically - each layer can
have sublayers.
A
CAAnimation
object causes a change over time. Typically, it changes one property
(like
opacity
) of a layer.
In this chapter, we will focus on
CALayer
, and in the next chapter, we'll focus on
CAAn-
imation
.