Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Tranformations - Core Animation
Search
Jasdev Singh
March 22, 2016
Technology
120
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
110
Hidden Gems in Swift
jasdev
6
1.5k
Swift 2.2 & 3.0 Changes
jasdev
1
730
Profiling
jasdev
0
93
Accessing Data
jasdev
0
120
Lessons in Building APIs
jasdev
0
140
UVA ACM Interview Tips
jasdev
0
130
Other Decks in Technology
See All in Technology
Reticulum, le réseau cypherpunk dont vous avez besoin !
rlifchitz
0
120
基本から分かる!AWSセキュリティ運用の考え方と任せ方
cmusudakeisuke
1
480
レガシーコードに対する loop engineering的なAI開発プロセス導入について
kubell_hr
0
310
公共分野での生成AI活用
toru_kubota
1
310
Kiro IDE 入門 (画面の各部から、頼み方、任せ方、戻し方まで) | 目指せ Kiro マスター 02
inariku
PRO
4
180
cdkd (CDK Direct)
gotok365
4
280
生成AI時代のIAMのマニアックな話
takuros
6
2.9k
Content Mapper APIの応用例~CSS Modules、言語ファイル~
uhyo
2
630
PostgreSQL オプティマイザ統計の秘密
nori_shinoda
1
440
The future of architectural work
ufried
0
190
AIコーディングはじめました
miso
0
160
Ebitengine製iOSアプリ公開ボタンを押す会
eiei114
0
110
Featured
See All Featured
Rails Girls Zürich Keynote
gr2m
96
14k
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
3
1.2k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.4k
Bootstrapping a Software Product
garrettdimon
PRO
306
120k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.6k
Music & Morning Musume
bryan
48
7.5k
A Tale of Four Properties
chriscoyier
163
24k
Darren the Foodie - Storyboard
khoart
PRO
4
4.1k
We Have a Design System, Now What?
morganepeng
55
8.4k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
Typedesign – Prime Four
hannesfritz
42
3.2k
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
12k
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