---
title: CATransition
framework: quartzcore
role: symbol
role_heading: Class
path: quartzcore/catransition
---

# CATransition

An object that provides an animated transition between a layer’s states.

## Declaration

```swift
class CATransition
```

## Overview

Overview You can transition between a layer’s states by creating and adding a CATransition object to it. The default transition is a cross fade, but you can specify different effects from a set of predefined transitions. The following code shows how you can transition between the two states of a CATextLayer named transitioningLayer. When the layer is first created, its backgroundColor is set to red and its string property is set to Red. When the runTransition() function is called, a new CATransition object is created and added to transitioningLayer, and the state of the layer is changed so that its background color is blue and its rendered text reads Blue. The end result is that the push transition animates the red state from left to right with the blue state entering the scene from the left. let transitioningLayer = CATextLayer()       override func viewDidLoad() {     super.viewDidLoad()     transitioningLayer.frame = CGRect(x: 10, y: 10,                                       width: 320, height: 160)          view.layer.addSublayer(transitioningLayer)          // Initial "red" state     transitioningLayer.backgroundColor = UIColor.red.cgColor     transitioningLayer.string = "Red" }            func runTransition() {     let transition = CATransition()     transition.duration = 2          transition.type = kCATransitionPush          transitioningLayer.add(transition,                            forKey: "transition")          // Transition to "blue" state     transitioningLayer.backgroundColor = UIColor.blue.cgColor     transitioningLayer.string = "Blue" }

## Topics

### Transition start and end point

- [startProgress](quartzcore/catransition/startprogress.md)
- [endProgress](quartzcore/catransition/endprogress.md)

### Transition Properties

- [type](quartzcore/catransition/type.md)
- [subtype](quartzcore/catransition/subtype.md)

### Custom transition filter

- [filter](quartzcore/catransition/filter.md)

### Constants

- [Common Transition Types](quartzcore/common-transition-types.md)
- [Common Transition Subtypes](quartzcore/common-transition-subtypes.md)

## Relationships

### Inherits From

- [CAAnimation](quartzcore/caanimation.md)

### Conforms To

- [CAAction](quartzcore/caaction.md)
- [CAMediaTiming](quartzcore/camediatiming.md)
- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSCoding](foundation/nscoding.md)
- [NSCopying](foundation/nscopying.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [NSSecureCoding](foundation/nssecurecoding.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Animation

- [CAAnimation](quartzcore/caanimation.md)
- [CAAnimationDelegate](quartzcore/caanimationdelegate.md)
- [CAPropertyAnimation](quartzcore/capropertyanimation.md)
- [CABasicAnimation](quartzcore/cabasicanimation.md)
- [CAKeyframeAnimation](quartzcore/cakeyframeanimation.md)
- [CASpringAnimation](quartzcore/caspringanimation.md)
- [CAValueFunction](quartzcore/cavaluefunction.md)
