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
iOS Core Animation Transform
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Qing-Cheng Li
February 12, 2015
Programming
210
0
Share
iOS Core Animation Transform
Introduction to iOS Core Animation Transform
Qing-Cheng Li
February 12, 2015
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
230
XingZhe - iOS BDD UI Automation Test Framework
qcl
0
660
High Performance iOS Apps Testing and Release
qcl
0
130
Mobile App Continuous Delivery
qcl
0
140
How QCLean Works: Introduction to Browser Extensions
qcl
0
690
黑暗時代網頁程式設計 - HTML
qcl
0
140
Big Data Processing lol
qcl
1
150
油電雙掌
qcl
0
900
Other Decks in Programming
See All in Programming
バックエンドにElysiaJSを採用して気付いた、良い点・悪い点
wanko_it
1
170
AIチームを指揮するOSS「TAKT」活用術 / How to Use “TAKT,” an OSS Tool for Orchestrating AI Teams
nrslib
5
610
タクシーアプリ『GO』の バックエンド開発のおける AI利活用と若者のすべて
pyama86
3
1.6k
1人1案件のプロダクトエンジニア時代に、"プロセス監督"としてチャレンジしたこと
non0113
0
290
oxlintはeslint/typescript-eslintを置き換えられるのか
shomafujita
2
200
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
680
SPMマルチモジュールで テストカバレッジを取得する技法
yosshi4486
0
120
Why Laravel apps break—Mastering the fundamentals to keep them maintainable
kentaroutakeda
1
180
iOS26時代の新規アプリ開発
yuukiw00w
0
200
Modding RubyKaigi for Myself
yui_knk
0
420
AIエージェントと協働するCLI開発 — BunとOpenClawで学んだこと
yoshikouki
1
210
Sans tests, vos agents ne sont pas fiables
nabondance
0
150
Featured
See All Featured
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
170
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
530
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.3k
Why Our Code Smells
bkeepers
PRO
340
58k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
260
The Language of Interfaces
destraynor
162
26k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.2k
Amusing Abliteration
ianozsvald
1
180
4 Signs Your Business is Dying
shpigford
187
22k
For a Future-Friendly Web
brad_frost
183
10k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2k
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.