Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Tranformations - Core Animation
Search
Jasdev Singh
March 22, 2016
Technology
100
0
Share
Tranformations - Core Animation
Chapter review from Nick Lockwood's Core Animation book at Tumblr's iOS Book Club
Jasdev Singh
March 22, 2016
More Decks by Jasdev Singh
See All by Jasdev Singh
Tuning for Speed
jasdev
0
88
Hidden Gems in Swift
jasdev
6
1.4k
Swift 2.2 & 3.0 Changes
jasdev
1
700
Profiling
jasdev
0
75
Accessing Data
jasdev
0
89
Lessons in Building APIs
jasdev
0
120
UVA ACM Interview Tips
jasdev
0
110
Other Decks in Technology
See All in Technology
AWSで2番目にリリースされたサービスについてお話しします(諸説あります)
yama3133
0
120
Databricks Appsで実現する社内向けAIアプリ開発の効率化
r_miura
0
320
すごいぞManaged Kubernetes
harukasakihara
1
320
建設的な現実逃避のしかた / How to practice constructive escapism
pauli
3
150
ログ基盤・プラグイン・ダッシュボード、全部整えた。でも最後は人だった。
makikub
1
210
Babylon.js を使って試した色々な内容 / Various things I tried using Babylon.js / Babylon.js 勉強会 vol.5
you
PRO
0
230
TUNA Camp 2026 京都Stage ヒューリスティックアルゴリズム入門
terryu16
0
670
Webアクセシビリティは“もしも”に備える設計
tomokusaba
0
160
【関西電力KOI×VOLTMIND 生成AIハッカソン】空間AIブレイン ~⼤阪おばちゃんフィジカルAIに続く道~
tanakaseiya
0
150
JSTQB Expert Levelシラバス「テストマネジメント」日本語版のご紹介
ymty
0
130
ADOTで始めるサーバレスアーキテクチャのオブザーバビリティ
alchemy1115
2
130
20260326_AIDD事例紹介_ULSC.pdf
findy_eventslides
0
520
Featured
See All Featured
Typedesign – Prime Four
hannesfritz
42
3k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
320
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.6k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
55k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
0
190
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
122
21k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
420
Building Applications with DynamoDB
mza
96
7k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
110
Transcript
TRANSFORMATIONS IOS BOOK CLUB JASDEV SINGH
AFFINE TRANSFORMATIONS > Rotation > CGAffineTransformMakeRotation(_:) > Scaling > CGAffineTransformMakeScale(_:_:)
> Translations > CGAffineTransformMakeTranslation(_:_:)
UIView transform PROPERTY Really just a wrapper on the underlying
CALayer feature, affineTransform.
COMPOSING TRANSFORMATIONS Core Graphics provides functions that take existing transformations
and applies another on top of it. > CGAffineTransformRotate(_:_:) > CGAffineTransformScale(_:_:_:) > CGAffineTransformTranslate(_:_:_:) > CGAffineTransformConcat(_:_:)
SAMPLE TRANSFORMATION > 50% scale > Rotate 30 degrees >
Vertical translation by 200 points public func +(lhs: CGAffineTransform, rhs: CGAffineTransform) -> CGAffineTransform { return CGAffineTransformConcat(lhs, rhs) }
import UIKit class ViewController: UIViewController { let view1 = UIView()
override func viewDidLoad() { super.viewDidLoad() view1.backgroundColor = .greenColor() view1.frame = CGRect(origin: view.center, size: CGSize(width: 150, height: 150)) view.addSubview(view1) let transform = CGAffineTransformIdentity + CGAffineTransformMakeScale(0.5, 0.5) + CGAffineTransformMakeRotation(CGFloat(M_PI) / 180 * 30) + CGAffineTransformMakeTranslation(0, 200) view1.layer.setAffineTransform(transform) } }
None
ARTISANAL TRANSFORMATIONS If you need to to make custom affine
transformations that aren't built into Core Graphics, you can directly set values on the transformation matrix:
3D TRANSFORMS The transform property on CALayer is of type
CATransform3D. > CATransform3DMakeRotation(_:_:_:_:) > CATransform3DMakeScale(_:_:_:) > CATransform3DMakeTranslation(_:_:_:)
Perspective Projections By default, Core Animation uses isometric projections, which
preserves parallel lines in 3D space. To give our 3D transformations a sense of depth, we have to add a perspective transform .
By default, . To apply perspective, set to , where
is the distance between the imaginary camera and the screen, in points. usually works well.
sublayerTransform PROPERTY A CATranmsform3D property on CALayer that allows you
to apply a transform to all sublayers!
doubleSided PROPERTY