Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Tranformations - Core Animation
Search
Jasdev Singh
March 22, 2016
Technology
0
91
Tranformations - Core Animation
Chapter review from Nick Lockwood's Core Animation book at Tumblr's iOS Book Club
Jasdev Singh
March 22, 2016
Tweet
Share
More Decks by Jasdev Singh
See All by Jasdev Singh
Tuning for Speed
jasdev
0
80
Hidden Gems in Swift
jasdev
6
1.4k
Swift 2.2 & 3.0 Changes
jasdev
1
700
Profiling
jasdev
0
70
Accessing Data
jasdev
0
75
Lessons in Building APIs
jasdev
0
110
UVA ACM Interview Tips
jasdev
0
99
Other Decks in Technology
See All in Technology
なぜ あなたはそんなに re:Invent に行くのか?
miu_crescent
PRO
0
210
通勤手当申請チェックエージェント開発のリアル
whisaiyo
3
460
[Neurogica] 採用ポジション/ Recruitment Position
neurogica
1
120
AI時代のワークフロー設計〜Durable Functions / Step Functions / Strands Agents を添えて〜
yakumo
3
2.2k
Amazon Bedrock Knowledge Bases × メタデータ活用で実現する検証可能な RAG 設計
tomoaki25
6
2.4k
AIエージェント開発と活用を加速するワークフロー自動生成への挑戦
shibuiwilliam
5
850
業務の煩悩を祓うAI活用術108選 / AI 108 Usages
smartbank
6
5.4k
Next.js 16の新機能 Cache Components について
sutetotanuki
0
180
AI との良い付き合い方を僕らは誰も知らない
asei
0
260
Building Serverless AI Memory with Mastra × AWS
vvatanabe
0
550
AgentCoreとStrandsで社内d払いナレッジボットを作った話
motojimayu
1
940
Snowflake導入から1年、LayerXのデータ活用の現在 / One Year into Snowflake: How LayerX Uses Data Today
civitaspo
0
2.4k
Featured
See All Featured
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
680
What the history of the web can teach us about the future of AI
inesmontani
PRO
0
370
SEO for Brand Visibility & Recognition
aleyda
0
4.1k
Faster Mobile Websites
deanohume
310
31k
First, design no harm
axbom
PRO
1
1.1k
Prompt Engineering for Job Search
mfonobong
0
130
The Power of CSS Pseudo Elements
geoffreycrofte
80
6.1k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
1
210
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
31
Automating Front-end Workflow
addyosmani
1371
200k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
850
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