Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
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
620
High Performance iOS Apps Testing and Release
qcl
0
120
Mobile App Continuous Delivery
qcl
0
120
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
バックエンドエンジニアによる Amebaブログ K8s 基盤への CronJobの導入・運用経験
sunabig
0
140
TUIライブラリつくってみた / i-just-make-TUI-library
kazto
1
360
Socio-Technical Evolution: Growing an Architecture and Its Organization for Fast Flow
cer
PRO
0
320
Developing static sites with Ruby
okuramasafumi
0
250
Full-Cycle Reactivity in Angular: SignalStore mit Signal Forms und Resources
manfredsteyer
PRO
0
120
C-Shared Buildで突破するAI Agent バックテストの壁
po3rin
0
380
【CA.ai #3】Google ADKを活用したAI Agent開発と運用知見
harappa80
0
290
手軽に積ん読を増やすには?/読みたい本と付き合うには?
o0h
PRO
1
170
リリース時」テストから「デイリー実行」へ!開発マネージャが取り組んだ、レガシー自動テストのモダン化戦略
goataka
0
120
sbt 2
xuwei_k
0
260
これだけで丸わかり!LangChain v1.0 アップデートまとめ
os1ma
6
1.7k
まだ間に合う!Claude Code元年をふりかえる
nogu66
2
370
Featured
See All Featured
Leading Effective Engineering Teams in the AI Era
addyosmani
8
1.3k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.1k
Facilitating Awesome Meetings
lara
57
6.7k
Git: the NoSQL Database
bkeepers
PRO
432
66k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
3.8k
The Invisible Side of Design
smashingmag
302
51k
Done Done
chrislema
186
16k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Music & Morning Musume
bryan
46
7k
Scaling GitHub
holman
464
140k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.3k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
7.8k
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.