HAPPY BOOKSGIVING
Use code BOOKSGIVING during checkout to save 40%-55% on books and eBooks. Shop now.
Register your product to gain access to bonus material or receive a coupon.
This eBook includes the following formats, accessible from your Account page after purchase:
EPUB The open industry format known for its reflowable content and usability on supported mobile devices.
PDF The popular standard, used most often with the free Acrobat® Reader® software.
This eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.
Core Animation is the technology underlying Apple’s iOS user interface. By unleashing the full power of Core Animation, you can enhance your app with impressive 2D and 3D visual effects and create exciting and unique new interfaces.
In this in-depth guide, iOS developer Nick Lockwood takes you step-by-step through the Core Animation framework, building up your understanding through sample code and diagrams together with comprehensive explanations and helpful tips. Lockwood demystifies the Core Animation APIs, and teaches you how to make use of
Approximately 356 pages.
www.informit.com/aw
Download free code files associated iOS Core Animation: Advanced Techniques here
iOS Core Animation: The Layer Tree
Download the sample pages (includes Chapter 1 and Index)
Preface
Audience and Material
Book Structure
Before We Begin
I: The Layer Beneath
1 The Layer Tree
Layers and Views
CALayer
Parallel Hierarchies
Layer Capabilities
Working with Layers
Summary
2 The Backing Image
The contents Image
contentsGravity
contentsScale
masksToBounds
contentsRect
contentsCenter
Custom Drawing
Summary
3 Layer Geometry
Layout
anchorPoint
Coordinate Systems
Flipped Geometry
The Z Axis
Hit Testing
Automatic Layout
Summary
4 Visual Effects
Rounded Corners
Layer Borders
Drop Shadows
Shadow Clipping
The shadowPath Property
Layer Masking
Scaling Filters
Group Opacity
Summary
5 Transforms
Affine Transforms
Creating a CGAffineTransform
Combining Transforms
The Shear Transform
3D Transforms
Perspective Projection
The Vanishing Point
The sublayerTransform Property
Backfaces
Layer Flattening
Solid Objects
Light and Shadow
Touch Events
Summary
6 Specialized Layers
CAShapeLayer
Creating a CGPath
Rounded Corners, Redux
CATextLayer
Rich Text
Leading and Kerning
A UILabel Replacement
CATransformLayer
CAGradientLayer
Basic Gradients
Multipart Gradients
CAReplicatorLayer
Repeating Layers
Reflections
CAScrollLayer
CATiledLayer
Tile Cutting
Retina Tiles
CAEmitterLayer
CAEAGLLayer
AVPlayerLayer
Summary
II: Setting Things in Motion
7 Implicit Animations
Transactions
Completion Blocks
Layer Actions
Presentation Versus Model
Summary
8 Explicit Animations
Property Animations
Basic Animations
CAAnimationDelegate
Keyframe Animations
Virtual Properties
Animation Groups
Transitions
Implicit Transitions
Animating Layer Tree Changes
Custom Transitions
Canceling an Animation in Progress
Summary
9 Layer Time
The CAMediaTiming Protocol
Duration and Repetition
Relative Time
fillMode
Hierarchical Time
Global Versus Local Time
Pause, Rewind, and Fast-Forward
Manual Animation
Summary
10 Easing
Animation Velocity
CAMediaTimingFunction
UIView Animation Easing
Easing and Keyframe Animations
Custom Easing Functions
The Cubic Bézier Curve
More Complex Animation Curves
Keyframe-Based Easing
Automating the Process
Summary
11 Timer-Based Animation
Frame Timing
NSTimer
CADisplayLink
Measuring Frame Duration
Run Loop Modes
Physical Simulation
Chipmunk
Adding User Interaction
Simulation Time and Fixed Time Steps
Avoiding the Spiral of Death
Summary
III: The Performance of a Lifetime
12 Tuning for Speed
CPU Versus GPU
The Stages of an Animation
GPU-Bound Operations
CPU-Bound Operations
IO-Bound Operations
Measure, Don’t Guess
Test Reality, Not a Simulation
Maintaining a Consistent Frame Rate
Instruments
Time Profiler
Core Animation
OpenGL ES Driver
A Worked Example
Summary
13 Efficient Drawing
Software Drawing
Vector Graphics
Dirty Rectangles
Asynchronous Drawing
CATiledLayer
drawsAsynchronously
Summary
14 Image IO
Loading and Latency
Threaded Loading
GCD and NSOperationQueue
Deferred Decompression
CATiledLayer
Resolution Swapping
Caching
The +imageNamed: Method
Custom Caching
NSCache
File Format
Hybrid Images
JPEG 2000
PVRTC
Summary
15 Layer Performance
Inexplicit Drawing
Text
Rasterization
Offscreen Rendering
CAShapeLayer
Stretchable Images
shadowPath
Blending and Overdraw
Reducing Layer Count
Clipping
Object Recycling
Core Graphics Drawing
The renderInContext: Method
Summary