starting core animation

13

Click here to load reader

Upload: john-wilker

Post on 08-May-2015

2.903 views

Category:

Technology


1 download

DESCRIPTION

Learn about Apple's powerful layer based animation framework to enhance user experience. Topics will include types of animation and layers.

TRANSCRIPT

Page 1: Starting Core Animation

Starting Core Animation

Page 2: Starting Core Animation

What is Core Animation?

• Framework for easily creating animated user interfaces.

• Tightly integrated with UIKit.

• Animate properties over time.

• Layer based.

Page 3: Starting Core Animation

Where is Core Animation Used?

• Everywhere!

• Navigation controllers, displaying modal view controllers, deselecting cells in a table view, flipping to an info screen, etc!

Page 4: Starting Core Animation

UIView Animation’s

• What you need most of the time.

• Happens within an animation block:

[UIView beginAnimations:nil context:NULL];

// change stuff

[UIView commitAnimations];

Page 5: Starting Core Animation

Customizing, a little.

• [UIView setAnimationDuration:]

• [UIView setAnimationCurve:]

• UIViewAnimationCurveEaseInOut UIViewAnimationCurveEaseIn UIViewAnimationCurveEaseOut UIViewAnimationCurveLinear

• Delay, repeat count, etc.

Page 6: Starting Core Animation

Built-inTransitions

• UIViewAnimationTransitionFlipFromLeft

• UIViewAnimationFlipFromRight

• UIViewAnimationTransitionCurlUp

• UIViewAnimationTransitionCurlDown

Page 7: Starting Core Animation

Transforms

• setTransform:(CGAffineTransform)

• Rotation, scale, translation, etc

Page 8: Starting Core Animation

Demo

Page 9: Starting Core Animation

Layers

• 2d object in 3d space.

• “Animation Container”

• Override layerClass method to change the type of a layer which your view uses.

Page 10: Starting Core Animation

Layer Types

• CALayer

• CAScrollLayer

• CATiledLayer

• CAEAGLLayer

Page 11: Starting Core Animation

Custom Animations

• Link against QuartzCore framework.

• Override actionForLayer:forKey: to return custom animation for property changes.

• Set animation on a layer directly to trigger an immediate animation.

Page 12: Starting Core Animation

Animation Types

• CABasicAnimation

• Go from point A to point B.

• CAKeyframeAnimation

• Go from A to B to C, etc.

• Animate along a path or by setting values and times

• Set calculation mode to paced, linear, or discrete.

• CAAnimationGroup

• Group multiple animations together.

Page 13: Starting Core Animation

Demo!