$30 off During Our Annual Pro Sale. View Details »
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
iOS Core Animation Transform
Search
Qing-Cheng Li
February 12, 2015
Programming
0
190
iOS Core Animation Transform
Introduction to iOS Core Animation Transform
Qing-Cheng Li
February 12, 2015
Tweet
Share
More Decks by Qing-Cheng Li
See All by Qing-Cheng Li
Using Buck to save iOS project build time
qcl
0
1.1k
Mobile App Continuous Delivery
qcl
0
210
XingZhe - iOS BDD UI Automation Test Framework
qcl
0
630
High Performance iOS Apps Testing and Release
qcl
0
120
Mobile App Continuous Delivery
qcl
0
130
How QCLean Works: Introduction to Browser Extensions
qcl
0
670
黑暗時代網頁程式設計 - HTML
qcl
0
130
Big Data Processing lol
qcl
1
140
油電雙掌
qcl
0
870
Other Decks in Programming
See All in Programming
AI Agent Tool のためのバックエンドアーキテクチャを考える #encraft
izumin5210
1
410
TerraformとStrands AgentsでAmazon Bedrock AgentCoreのSSO認証付きエージェントを量産しよう!
neruneruo
4
1.5k
マスタデータ問題、マイクロサービスでどう解くか
kts
0
110
愛される翻訳の秘訣
kishikawakatsumi
3
340
これならできる!個人開発のすゝめ
tinykitten
PRO
0
120
生成AIを利用するだけでなく、投資できる組織へ
pospome
2
390
俺流レスポンシブコーディング 2025
tak_dcxi
14
9.4k
生成AI時代を勝ち抜くエンジニア組織マネジメント
coconala_engineer
0
290
チームをチームにするEM
hitode909
0
360
手が足りない!兼業データエンジニアに必要だったアーキテクチャと立ち回り
zinkosuke
0
810
開発に寄りそう自動テストの実現
goyoki
2
1.4k
perlをWebAssembly上で動かすと何が嬉しいの??? / Where does Perl-on-Wasm actually make sense?
mackee
0
110
Featured
See All Featured
Side Projects
sachag
455
43k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
37
2.7k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
41
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
1
260
Measuring & Analyzing Core Web Vitals
bluesmoon
9
710
Balancing Empowerment & Direction
lara
5
810
It's Worth the Effort
3n
187
29k
Writing Fast Ruby
sferik
630
62k
Building AI with AI
inesmontani
PRO
1
570
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
0
2.2k
Amusing Abliteration
ianozsvald
0
66
Transcript
Transforms @qcl 2015.02.12
None
Transform • Affine Transforms ◦ CGAffineTransform ◦ view.layer.affineTransform • 3D
Transforms ◦ CATransform3D ◦ view.layer.transfrom ◦ view.layer.sublayerTransform
Affine Transforms • Math behind the matrix ◦ https://developer.apple. com/library/mac/documentation/GraphicsImaging/Co
nceptual/drawingwithquartz2d/dq_affine/dq_affine. html#//apple_ref/doc/uid/TP30001066-CH204-
Affine Transforms • Rotation ◦ CGAffineTransformMakeRotation(CGFloat angle) • Scale ◦
CGAffineTransformMakeScale(CGFloat sx, CGFloat sy) • Translation ◦ CGAffineTransformMakeTranslation(CGFloat tx, CGFloat ty)
Combining Transforms • CGAffineTransformIdentity ◦ A 3x3 Identity matrix •
Rotation ◦ CGAffineTransformRotate(CGAffineTransform t, CGFloat angle) • Scale ◦ CGAffineTransformScale(CGAffineTransform t, CGFloat sx, CGFloat sy) • Translation ◦ CGAffineTransformTranslate(CGAffineTransform t, CGFloat tx, CGFloat ty) • The order you apply transforms is important! ◦ 矩陣乘法沒有交換律
Customized Affine Transform • You can set the fileds of
a CGAffineTransform directly. ◦ a ◦ b ◦ c ◦ d ◦ t x ◦ t y
3D Transforms
3D Transforms • Left hand coordinate system
3D Transforms • Rotation ◦ CATransform3DMakeRotatation(CGFloat angle, CGFloat x, CGFloat
y, CGFloat z) • Scale ◦ CATransform3DMakeScale(CGFloat sx, CGFloat sy, CGFloat sz) • Translation ◦ CATransform3DMakeTranslation(CGFloat tx, CGFloat ty, CGFloat tz)
3D Transforms Combination • CATransform3DIdentity ◦ A 4x4 identity matrix
• Rotation ◦ CATransform3DRotate(CATransform3D t, CGFloat angle, CGFloat x, CGFloat y, CGFloat z) • Scale ◦ CATransform3DScale(CATransform3D t, CGFloat sx, CGFloat sy, CGFloat sz) • Translation ◦ CATransform3DTranslate(CATransform3D t, CGFloat tx, CGFloat ty, CGFloat tz)
Perspective Projection • Prespective transform sometimes called Z transform
Perspective Projection • m34 of CATransform3D • -1 / d
• More: ◦ http://en.wikipedia. org/wiki/3D_projection#Perspective_projection
Vanishing Point • anchorPoint
sublayerTransform • Apply to sublayer but not affect itself. •
The vanishing point is the anchorPoint of itself, not sublayer’s anchorPoint
Backfaces • view.layer.doubleSided
Layer Flattening • Expected result is wrong. • The layers
don’t exist in the same 3D space. • The 3D sence in each layer is flattened.