
Object transformations are techniques used to change the appearance or position of UI elements such as views or images.
Object transformations are techniques used to change the appearance or position of UI elements such as views or images.
They include:
Animation is the process of making UI changes smooth over time instead of instantly.
Displaying multiple images in sequence to create a frame-by-frame animation.
Playing video files inside an iOS app using frameworks like AVFoundation or AVKit.
Used to apply:
Used for smooth transitions.
Used for frame-based image sequences.
Used for video playback.
π Moves an object horizontally or vertically
view.transform = CGAffineTransform(translationX: 50, y: 0)
π Increases or decreases size
view.transform = CGAffineTransform(scaleX: 2.0, y: 2.0)
π Rotates object around center
view.transform = CGAffineTransform(rotationAngle: .pi / 4)
π (Ο/4 = 45 degrees)
view.transform =
CGAffineTransform(translationX: 50, y: 50)
.rotated(by: .pi / 4)
.scaledBy(x: 1.5, y: 1.5)
imageView.animationImages = [
UIImage(named: "img1")!,
UIImage(named: "img2")!,
UIImage(named: "img3")!
]
imageView.animationDuration = 1.0
imageView.startAnimating()
imageView.stopAnimating()
Image1 β Image2 β Image3 β Loop (Animation)
import AVKit
import AVFoundation
let videoURL = URL(string: "https://example.com/video.mp4")!
let player = AVPlayer(url: videoURL)
let playerViewController = AVPlayerViewController()
playerViewController.player = player
present(playerViewController, animated: true) {
player.play()
}
Video URL β AVPlayer β AVPlayerViewController β Play Video
Image animation:
Video playback:
Object animation:
Transformations:
Image animation:
Video playback:
Used in:
Open this section to view and download past papers
Click on Show Past Papers to load available exam papers.