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
Nacho Soto's Slides at NSSpain 2013
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Luis Ascorbe
September 17, 2013
Programming
140
4
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Nacho Soto's Slides at NSSpain 2013
NSSpain is an iOS & OSX developers conference in Spain.
More info:
http://nsspain.com
Luis Ascorbe
September 17, 2013
More Decks by Luis Ascorbe
See All by Luis Ascorbe
Snapshot Testing at CMD+U Conf
lascorbe
2
150
Dave Verwer's Slides at NSSpain 2014
lascorbe
0
130
Andrew Yates' Slides at NSSpain 2014
lascorbe
0
120
Alberto Lopez's Slides at NSSpain 2014
lascorbe
0
45
Erik Erice's Slides at NSSpain 2014
lascorbe
0
100
Krzysztof Zabłocki's Slides at NSSpain 2013
lascorbe
8
460
Luis Solano's Slides at NSSpain 2013
lascorbe
3
140
Daniel Eggert's Slides at NSSpain 2013
lascorbe
8
220
Other Decks in Programming
See All in Programming
Claspは野良GASの夢をみるか
takter00
0
200
Skillsは効率化、Agentsは"自分の拡張"——Builder時代のエージェント編成(CC Night 2026)
wemra
1
140
New "Type" system on PicoRuby
pocke
1
980
ADKを使って簡単にAIエージェントを作ってみよう
k1mu21
0
270
フロントエンドとバックエンドで「1文字」を揃えよう
youkidearitai
PRO
0
710
Semantic Version 単位で戦略を柔軟に変えて、パッケージアップデートを自動化する
daitasu
1
260
Lessons from Spec-Driven Development
simas
PRO
0
210
気圧・高度・GPSを記録&可視化するアプリ「Koudo」を作った話
hjmkth
1
300
jQueryをバージョンアップする前に使いたいjQuery Migrate
matsuo_atsushi
0
560
ふつうのFeature Flag実践入門
irof
8
4.1k
AI時代のUIはどこへ行く?その2!
yusukebe
22
7.4k
AI 時代のソフトウェア設計の学び方
masuda220
PRO
29
13k
Featured
See All Featured
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
10k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
250
Documentation Writing (for coders)
carmenintech
77
5.4k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
170
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
230
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.5k
Automating Front-end Workflow
addyosmani
1370
210k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
360
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
430
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
210
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
56k
Transcript
CREATING ANIMATIONS WITH CORE ANIMATION & CORE GRAPHICS Mobile Lead,
MindSnacks Inc. Creator of Sayonara app. Nacho Soto
AGENDA Animation types: Basic animations. Animating transforms. Using Paths. Keyframe
animations. Mixing things up with Core Graphics: Animating a programmatically drawn view. How to make it fast. • • • • • • • •
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:NSStringFromSelector(@selector(opacity))]; animation.fromValue = @0.0f; animation.toValue =
@1.0f; animation.duration = 5; [layer addAnimation:animation forKey:animation.keyPath]; BASIC ANIMATION
const CATransform3D transform = CATransform3DMakeScale(1, 0, 0); CABasicAnimation *animation =
[CABasicAnimation animationWithKeyPath:NSStringFromSelector(@selector(transform))]; animation.toValue = [NSValue valueWithCATransform3D:transform]; [layer addAnimation:animation forKey:animation.keyPath]; NOT SO BASIC ANIMATION
UIBezierPath *bezierPath = [UIBezierPath bezierPathWithRect:rect]; CAKeyframeAnimation *pathAnimation = [CAKeyframeAnimation animationWithKeyPath:NSStringFromSelector(@selector(position))];
pathAnimation.path = bezierPath.CGPath; [layer addAnimation:pathAnimation forKey:pathAnimation.keyPath]; PATH ANIMATIONS
KEYFRAME ANIMATIONS CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"position.x"]; animation.values = [[NSArray
arrayWithRange:NSMakeRange(0, 100)] mapUsingBlock:^(NSNumber *number) { return @(pow(number.unsignedIntegerValue, 3) / 3000.f); }];
CORE ANIMATION + CORE GRAPHICS
WHY IS IT SLOW? I have the newest graphics card!
IT’S NOT ALL ABOUT THE GPU CoreGraphics.framework Quartz 2D Quartz
Services QuartzCore.framework Core Animation Core Image Rendering occurs in the CPU. Then textures are transferred to VRAM and composited there. We only have 1 / 60s (0.016s) to do all the work.
SO HOW DO WE MAKE RENDERING FASTER? DO NOT RENDER
NOT RENDERING MEANS CACHING Solution number 1: use stretchable images.
• Solution number 2: ? •
IDEA: Let’s render all the frames in advance. But, how
do we update the layer each frame?
SPRITE SHEETS
ABOUT ME Currently: Mobile Lead, MindSnacks Inc. Created Sayonara app.
Previously: Web and iOS developer at Ticketea.
[email protected]