Transforms and 3D Effects
Apply affine and 3D transforms.
Transforms Move and Distort
A transform reshapes a layer—translate, scale, rotate, skew—without changing its bounds. Core Animation supports both 2D (CGAffineTransform) and 3D (CATransform3D).
2D Affine Transforms
CGAffineTransform handles flat transforms. Combine them by concatenation; order matters.
import UIKit
var t = CGAffineTransform.identity
t = t.scaledBy(x: 1.5, y: 1.5)
t = t.rotated(by: .pi / 6)
layer.setAffineTransform(t)All lessons in this course
- CALayer Fundamentals
- Implicit and Explicit Animations
- Transforms and 3D Effects
- Custom Drawing with Core Graphics