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
110
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
93
Hidden Gems in Swift
jasdev
6
1.4k
Swift 2.2 & 3.0 Changes
jasdev
1
720
Profiling
jasdev
0
83
Accessing Data
jasdev
0
110
Lessons in Building APIs
jasdev
0
130
UVA ACM Interview Tips
jasdev
0
120
Other Decks in Technology
See All in Technology
ラジオの科学
frievea
0
280
システム思考で問題に対処する
yussak
0
210
変化の早いClaude Codeを 書籍に落とし込む
oikon48
7
1.3k
取引先から届く 「セキュリティチェックシート」の読み解き方
kamadamakoto
0
140
オートロックマンションなのに、各部屋は施錠なし!? 攻撃者が組織内ネットワークで大暴れする理由 / The Front Door Is Locked, but the Rooms Are Wide Open: Why Attackers Move Freely Inside Enterprise Networks
nttcom
1
1.6k
LLM・AIエージェントシステムベストプラクティス
shibuiwilliam
2
630
メルカリのグローバルアプリで挑んだ AlloyDB 運用と課題解決の実践記
hatappi
0
240
QAエンジニア起点で進める、SmartHRにおける信頼性向上について
kaomi_wombat
1
120
トヨタ⽣産⽅式(TPS)⼊⾨
recruitengineers
PRO
3
660
Agent 時代の Kaggle 展望 / kaggle-in-the-agentic-era
upura
1
680
Webアクセシビリティ入門 2026
recruitengineers
PRO
3
460
モノリス Rails でも日中に rails db:migrate を走らせたい! / Daytime rails db:migrate on Monolithic Rails!
euglena1215
4
550
Featured
See All Featured
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
4.2k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
490
Testing 201, or: Great Expectations
jmmastey
46
8.2k
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2.1k
The Cost Of JavaScript in 2023
addyosmani
55
10k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
790
Writing Fast Ruby
sferik
630
63k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
260
Rails Girls Zürich Keynote
gr2m
96
14k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
890
Crafting Experiences
bethany
1
240
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