![]() Core Animation introduces a new type of proxy in communicating information about visual changes in state. This can be complicated and messy.Ĭore Animation takes a lot of the work out of the equation for simple animation types. In order to get smooth animation we have calculate the intermediate values between the initial and final states and draw them accordingly. As you’ll see in the example below, we can vary a number of properties of views including height, width, rotation, opacity and color to name a few. ![]() When we talk about animation we’re talking about changing a property over time. So while an animation is running your application can continue to do other things. But since almost all new Mac’s ship with multiple CPU’s/cores, Core Animation is threaded to take advantage of that as well. Two other things I should note is that Core Animation uses OpenGL for processing the rendering queue. Back the elements you need, and leave the rest off (when convenient to do so) and conserve that video RAM for something else. So keep this in mind when setting up your layers. For each layer-backed view you have, there exists some allocation of memory (video memory) that is being occupied by that cached copy. Right? However, it’s important to remember that a layer is nothing more than a cached copy of a particular element. If you do so, then all of your subviews get layers automatically. This is important to remember since if we forget and try to apply Core Animation to a non-backed view, nothing will happen.Īt this point it might be tempting to conclude that you should always back the top most view in a rendering tree with a layer. If we create a backing layer for our button, the application window isn’t layer-backed. Each subview of a layer-backed view is layer-backed (by design). If that window is layer-backed, then by default the button and table view are also layer-backed. Take for example an application Window with a button and table view. If a view has a layer it is said to be “layer-backed.” The cached layer is what is processed by the video hardware to produce the smooth visual effects we see in Core Animation enabled applications. With Core Animation views are backed by an animation layer, which is effectively a cached copy of the view (remember, buttons, sliders, image wells, windows etc… are all considered “views”). Traditionally animation in Mac OS X is done via AppKit’s Animation API’s. Core Animation introduces a new concept to AppKit based views called “Layers.” It serves as part of the graphics unification layer which previously included QuickTime, Core Image and Quartz. But think of Core Animation as an extension of AppKit which is the applications framework that drives much of what you see on Mac OS X.Ĭore Animation sits between the programmer accessible elements of basic Cocoa animations and the underlying graphics hardware powered by OpenGL. So how does Core Animation “work” ? That isn’t so simple. And as you’ll see, basic Core Animation transitions are dead simple to deploy (of course you can get extremely complicated for truly stunning effects, but that is not for this tutorial). The difference between Tigers Preview zoom and Leopards is subtle, but very graceful. ![]() He or She probably didn’t because it was a lot of work to do this manually.Ģ) You’d notice that in going from one size to the other that it jumped instantly from the original size to the new one. In Tiger you’d get one of two things.ġ) If the engineer took the time to keyframe the transitions from one step to another you’d also get the smooth transition. ![]() What you’ll notice is that the image smoothly transitions from the original size to the new size. For another more subtle example do the following:Ģ) Press the Zoom In button and watch the zoom process as it occurs If you are on Leopard (or have an iPhone or iPod Touch), you’ve seen examples of Core Animation already. Core Animation unloads a lot of the complexity in generating animated UI elements by providing an additional layer of abstraction between the programmer and underlying software/hardware interfaces. Some would argue it’s purely eye-candy, but visual feedback is an important element of good UI design.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |