Graphics Reference
In-Depth Information
1
Ogres have layers. Onions have layers. You get it? We both have layers.
Shrek
Core Animation is misleadingly named. You might assume that its primary purpose is
animation
,
but actually animation is only one facet of the framework, which originally bore
the less animation-centric name of
Layer Kit.
Core Animation is a
compositing engine
;
its job is to compose different pieces of visual
content on the screen, and to do so as fast as possible. The content in question is divided
into individual
layers
stored in a hierarchy known as the
layer tree.
This tree forms the
underpinning for all of UIKit, and for everything that you see on the screen in an iOS
application.
Before we discuss animation at all, we're going to cover Core Animation's
static
compositing and layout features, starting with the layer tree.
If you've ever created an app for iOS or Mac OS, you'll be familiar with the concept of a
view.
A view is a rectangular object that displays content (such as images, text, or video),
and intercepts user input such as mouse clicks or touch gestures. Views can be nested inside
one another to form a hierarchy, where each view manages the position of its children
(
subviews
). Figure 1.1 shows a diagram of a typical view hierarchy.