Class

CAAnimation

CAAnimation is an abstract animation class. It provides the basic support for the CAMediaTiming and CAAction protocols. To animate Core Animation layers or Scene Kit objects, create instances of the concrete subclasses CABasicAnimation, CAKeyframeAnimation, CAAnimationGroup, or CATransition.

Overview

Animating Core Animation Layers

You can animate the contents of your iOS or macOS app’s user interface by attaching animations to CALayer objects. For more information, see Core Animation Programming Guide.

Animating Scene Kit Content

In Scene Kit, animation objects represent not only property-based animations, but also animations of geometry data created with external 3D authoring tools and loaded from a scene file. You use the properties of the CAAnimation object representing a geometry animation to control its timing, monitor its progress, and attach actions for Scene Kit to trigger during the animation. You can attach animations to Scene Kit objects that adopt the SCNAnimatable protocol, including nodes, geometries, and materials.

In a Scene Kit app, CAAnimation objects support additional methods and properties, listed under Controlling SceneKit Animation Timing, Fading Between SceneKit Animations, and Attaching SceneKit Animation Events.

Symbols

Archiving properties

func shouldArchiveValue(forKey: String)

Specifies whether the value of the property for a given key is archived.

Providing default values for properties

class func defaultValue(forKey: String)

Specifies the default value of the property with the specified key.

Animation attributes

var isRemovedOnCompletion: Bool

Determines if the animation is removed from the target layer’s animations upon completion.

var timingFunction: CAMediaTimingFunction?

An optional timing function defining the pacing of the animation.

Getting and setting the delegate

var delegate: CAAnimationDelegate?

Specifies the receiver’s delegate object.

Controlling SceneKit Animation Timing

var usesSceneTimeBase: Bool

For animations attached to SceneKit objects, a Boolean value that determines whether the animation is evaluated using the scene time or the system time.

Fading Between SceneKit Animations

var fadeInDuration: CGFloat

For animations attached to SceneKit objects, the duration for transitioning into the animation’s effect as it begins.

var fadeOutDuration: CGFloat

For animations attached to SceneKit objects, the duration for transitioning out of the animation’s effect as it ends.

Attaching SceneKit Animation Events

var animationEvents: [SCNAnimationEvent]?

For animations attached to SceneKit objects, a list of events attached to an animation.