Core Animation for Mac OS X and the iPhone
ISBN: 1934356107
Reviewer Ratings
Relevance:Readability:
Overall:
Buy it now
One Minute Bottom Line
| If you already have a fundamental understanding of Objective-C programing and want to lean to how to harness the power of Core Animation, OpenGL, and Quartz, than Bill Dudney will quickly get you up speed in 175 pages. |
Review
This book is for the programmer who wants to quickly get up to speed with the fundamentals of Core Animation, and is already familiar with Objective-C programming. The book also lightly touches on the topics of the OpenGL and Quartz frameworks, but leaves it to the reader to investigate these in more detail. For those that are looking to apply Core Animation to there iPhone applications do not be dismayed that there is only one chapter devoted to the topic. Roughly 90 percent of what is learned in the first 11 chapters can be directly applied to the iPhone platform. The one chapter just shows you the small differences, and what you cannot do, and is more than enough text for the topic.
Chapter 1: Introduction
This chapter provides a brief background on how animation has been a part of OS X from the beginning and how it has been used to enhance the usability of the operating system UI. It then discusses that Core Animation is based on the concept of 'layers', it's aim is to greatly simplify developers' efforts in adding animation.
Chapter 2: Cocoa AnimationHere you'll learn that animation has a legitimate reason for being in OS X and the iPhone, and is not 'eye candy'. The author starts off with a simple example of taking a photo, moving it across the screen, and scaling it down. This is first demonstrated without animation, which shows how unsettling the user's experience is as it just jumps from one point to another. A default animation is then added to the code to more fluidly transfer between the two states. This is a very powerful demonstration because it shows you how easy it is to add animations after the fact, but more importantly, what you don't have to add: threading and the tedious math to do the interpolation between states.
Chapter 3: Animation TypesThis builds on the basic animation presented in chapter 2 and introduces Keyframe animations. Keyframe animations allows you to have more temporal control of your animations. The book demonstrates a fade-in-fade-out effect by adjusting the opacity of the image over the duration of the animation. The author also shows how easy it is to move form the linear animation in chapter 1 to an animation that follows a specific path. The chapter wraps up with a demo of how easy it is to combine various animations.
Chapter 4: Animation TimingHere, the book moves out of the world of liner animation timing. Introduces Core Animations Ease-In, Ease-Out, Ease-In-Ease-Out, and Custom time spans. This chapter also shows how to adjust the duration of the animations using Animation Context Grouping and the setDuration method. It wraps up by providing an example on how animations can be chained together using one animation's delegate to notify another animation that it stopped and it should start.
Chapter 5: Layer-Backed ViewsHere you'll learn the additional benefits provided to your program by adding the single line of code: myVeiw.wantsLayer = YES. By adding that link of code to your view hierarchy we gain the ability to rotate views and controls, add drop shadows, and adjust the alpha.
Chapter 6: Filtered ViewsThis chapter wraps up the Cocoa-base Core Animation techniques by showcasing the application of filters to your views. Demonstrations are provided on how to apply filters to the background as well as the contents of a view. The chapter wraps up filter chaining and composite views.
Chapter 7: Core AnimationThis chapter is an intro to layers and how they are the heart of the Core Animation Framework. We learn how the concept of a Layer View is similar to a regular Cocoa view, in that it is hierarchical in construct, but instead of being backed by a NSView it is backed by a Layer and does not respond to events a la NSResponders. Layers main advantage over views is that they can host a varying degree of content at the same time. Once the basics of layers are established, we start working on the books sample app - a Front Row clone - and learn how to create UI's with layers. The chapter wraps up by examining the CAConstraintLayout Manager which gives us a mechanism for binding and constraining our layers in a easy way.
Chapter 8: Core Animation LayersThis starts off by taking the Keyframe animation example from chapter 3 and converting it to a layer-based animation. The example demonstrates how to trigger a composite animation via an event. We then learn how to adjust the timing of the animation with the CAMediaTiming protocol. As we progress through the example we learn how to rotate layers, adjust the rotation offset, apply filters, and effectively manage the contents of a layer. The section on Tiled Layer demonstrates how to deal with content that is larger than the bounds of the layer.
Chapter 9: Layer Scrolling and GeometryBuilding on the sample Front Row application, this chapter demonstrates how to use Core Animations CAScrollLayer. The example shows how the CAScrollLayer provides a clipping mask to its sub-layers to let you manage a document that is too large to show all at once. The second half of this chapter discusses the geometry properties of layers: frame, bounds, position, anchor point, corner radius, layer depth, and transformations.
Chapter 10: Layers in 3DContinuing to build on the Front Row demo application, here we start to learn about zPositioning our layers in a 3D space, and how to use the CATransform3D to create the rotating-plater-of-icons that Front Row uses. The examples take you through two ways to achieve this effect: using coordinates to approximate the images moving, and using 3D Transformations. Along the way to creating the rotating plater we are also shown how to create a custom layout manager.
Chapter 11: Media LayersThis is an introduction to three media layers: QuickTime, Quartz Composer, and OpenGL. For QuickTime Layers the author uses Movie Layers to demonstrate how to display multiple .mov files in a layer, while starting and stopping the move based on it's focus. Also in QuickTime we lean how to use Capture Layers to integrate iSight and apply filters to what ever it is capturing. Next we move on to Quartz Composer Layers, which is only a demo of an existing Quartz Composition that ships with Leopard. However as stated by the author, the subject of Quartz is worthy of its own book. Finally we move on to OpenGL, where we learn to draw a 3D cube which rotates around its axis.
Chapter 12: Core Animation on the iPhoneUp until this last chapter, all the examples have been desktop applications. Here we lean how to apply the knowledge we acquired in the previous eleven chapters to CocoaTouch and the iPhone. The first thing we learn is that all views on the iPhone are backed by CoreAnimations CALayer. There are a few things missing on the iPhone. One is CoreImage, without which we are not able to specify custom transitions or filters for our UIVeiws. We also are missing Quartz Composer and Quick Time API's and frameworks. However a lightweight version of OpenGL is available in the form of OpenGL ES.
To effectively follow along with all of the examples, it is best to download the sample code which can be found at the Pragmatic Bookshelf. Errata and a discussion forum for the the book can also be found there. As you dive further into the Core Animation framework you will also want to take advantage of Apples documentation. The book has a through bibliography of the Apple documents that cover Core Animation, OpenGL, and Quartz.
- Login or register to post comments
- 1963 reads
- Printer-friendly version
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)









