O'Reilly logo

Cocoa Programming for OS X: The Big Nerd Ranch Guide by Aaron Hillegass, Adam Preble, Nate Chandler

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Implicit Animation and Actions

Before we talk about what is going on in presentImage(_:), let’s look at how the most basic animation is done with Core Animation. Imagine that you have a CALayer called layer that is displayed on the screen. Suppose that you set its position like so:

l​a​y​e​r​.​p​o​s​i​t​i​o​n​ ​=​ ​C​G​P​o​i​n​t​(​x​:​ ​5​0​,​ ​y​:​ ​5​0​)​

This simple action animates the layer from its current position to the new position: implicit animation. Many properties of layers can be animated by simply setting them. The didSet observer of the text property uses implicit animation to change the size of the black status bubble.

What if you want to customize these animations? As it turns out, there are several styles for ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required