SlideShare a Scribd company logo
1 of 58
Download to read offline
Crafting Interactions
with Core Animation
David Ortinau
@davidortinau
http://davidortinau.com
17 yrs web, desktop, interactive, mobile.
BA English,
Maryville University
Let’s Talk About
Animation
Architecture of Core Animation
Implicit Animations and Explicit Animations
Tweening!
Real World Use Cases
•
•
•
•
•
Animation?
http://www.nestmagazine.es/2012/04/entrevista-kyle-bean.html
Interaction Design (IxD) defines the structure and
behavior of interactive systems.
Interaction Designers strive to create meaningful
relationships between people and the products and
services that they use, from computers to mobile
devices to appliances and beyond.
Bill Moggridge’s 3 Questions
How do you do?
How do you feel?
How do you know?
1.
2.
3.
Core Animation Makes it Easy
UIView.Animate (
duration: 4,
animation: () => {
notification.Frame = new RectangleF (new
PointF (0, 0), notification.Frame.Size);
}
);
Architecture
https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CoreAnimation_guide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40004514
UIKit /
AppKit
OpenGL ES / Open
GL
Graphics Hardware
Core
Animation
Core Graphics
CAAnimation
CAGroupAnimation
CAPropertyAnimation
CABasicAnimation
CAKeyframeAnimation
CATransition
CALayer
addSubLayer
insertSubLayer
setNeedsDisplay
setNeedsLayout
Every UIView has a CALayer
UIViews are responsible for interactions
CALayers are responsible for what you see
•
•
UIView someView = new UIView();
someView.LayerLayer.Frame = new RectangleF(0, 0, 100, 100);
What you see is a compositing of layers
UIView
CALayer
UIView
UIView
UIImage
UILabel
UIButton
UIButton
UIButton
UIButton
UIButton
UIButton
UIView
CALayer
UIView
UIButton
UIButton
UIButton
UIButton
UIButton
UIButton
UIView
UIImage
UILabel
CALayer
Every UIView has a layer and sets itself as the delegate for that layer
CALayer manages visual content and the geometry of that content
drawRect creates the layer
•
•
•
https://developer.apple.com/library/mac/#documentation/GraphicsImaging/Reference/CALayer_class/Introduction/Introduction.html
CALayer someLayer = new CALayer();
someLayer.Frame = new RectangleF(0, 0, 300, 40);
someLayer.Contents = UIImage.FromFile('path/to/image.png').CGImage;
Layer Geometry
https://developer.apple.com/library/mac/#documentation/GraphicsImaging/Reference/CALayer_class/Introduction/Introduction.html
x
y
+
Bounds
AnchorPoint
Bounds - CGRect
Position - CGPoint
AnchorPoint - CGPoint
Transform-CATransform3D
•
•
•
•
What Core Animation Provides
Interpolation
Timing
Hardware Accelerated. Animations happen on the GPU.
Animations are on a background thread
•
•
•
•
CALayer Hierarchy
CAShapeLayer
CATileLayer
CATextLayer
CAScrollLayer
CAReplicatorLayer
•
•
•
•
•
https://developer.apple.com/library/mac/#documentation/GraphicsImaging/Reference/CALayer_class/Introduction/Introduction.html
Animation Rendering
Layout is on the CPU. Keep visuals flat for better performance.
Animation is on the GPU.
•
•
WWDC Session 238 iOS App Performance: Graphics and Animations
1. Create animation and update view hierarchy
2. Prepare and commit
animation
3. Render each frame
Implicit Animations
Implicit Animations of Layer-Backed Views
Uses default timing and animation properties
UIView must be wrapped in an Animate block
UIView Properties
Frame
Center
BackgroundColor
Opacity
•
•
•
•
•
•
•
Notifications Demo
Animate Block
UIView.Animate (
duration: 4,
delay: 0,
options: UIViewAnimationOptions.CurveEaseIn,
animation: () => {
notification.Frame = new RectangleF
(new PointF (0, 0), notification.Frame.Size);
} ,
completion: null
);
UIViewAnimationOptions
AllowUserInteraction
Autoreverse
CurveLinear, CurveEaseIn, CurveEaseOut, CurveEaseInEaseOut
Repeat
•
•
•
•
UIViewAnimationOptions
Easing is the pace of the animation over time•
Glow Pulse Demo
UIView.Animate(
duration: 1,
delay: 0,
options: UIViewAnimationOptions.Autoreverse |
UIViewAnimationOptions.Repeat,
animation: ()=>{
glow.Alpha = 1;
} ,
completion: null
);
Explicit Animations
Explicit Animations
CABasicAnimation, CAGroupAnimation, CAKeyframeAnimation
More fine grain control of the animation
Only works on the Layer and doesn’t update the View
FillMode = CAFillMode.Forwards
RemovedOnCompletion = false
Sequence animations
Custom animation of your own properties
•
•
•
•
•
•
•
CABasicAnimation
KeyPath - the property to animate
BeginTime - when in time to start, can be used to stagger
sequenced animations
Duration - how long the animation should take, scaled to the
timeline of the parent
From / To
RemoveOnCompletion, FillMode
AnimationStopped, AnimationStarted
TimingFunction - Linear, EaseIn, EaseOut, EaseInEaseOut
•
•
•
•
•
•
•
Attraction Loop Demo
Flow
createSlide() - adds or updates CALayer with new images
transitionIn() - clears old animations, defines new animations, adds them to
layers, Timer calls transitionOut
transitionOut() - defines out animations, adds to layers, AnimationStopped
signals end
cyclesSlides() - increments slide and restarts the loop calling createSlide
CABasicAnimation
titleImage.RemoveAllAnimations();
var localMediaTime = CAAnimation.CurrentMediaTime();
var titleAnim = CABasicAnimation.FromKeyPath("position.x");
titleAnim.Duration = 1;
titleAnim.BeginTime = localMediaTime;
titleAnim.From = NSNumber.FromFloat ( 768f );
titleAnim.To = NSNumber.FromFloat ( View.Frame.Width * 0.5f );
titleAnim.RemovedOnCompletion = false;
titleAnim.FillMode = CAFillMode.Forwards;
titleAnim.TimingFunction = CAMediaTimingFunction.FromName (CAMediaTimingFunction.EaseOut);
titleImage.AddAnimation ( titleAnim, "position.x" );
timer = new System.Timers.Timer ();
timer.Interval = 5000;
timer.Elapsed += (object sender, ElapsedEventArgs e) => {
timer.Stop();
InvokeOnMainThread(()=>{
transitionOut();
} );
} ;
timer.Start();
Everyone Wants to Spin
var spinAnim = new CABasicAnimation {
KeyPath = "transform.rotation.z",
To = NSNumber.FromDouble( Math.PI ),
Duration = 0.4,
Cumulative = true,
RepeatCount = 999
} ;
spinner.Layer.AddAnimation( spinAnim,
"spinMeRightRoundBabyRightRound" );
CAKeyframeAnimation
Animate along a path
Set keyframes for very fine control of the timing
Properties
Path - a bezier curve to follow
KeyTimes - 1:1 with values, from 0 to 1 over duration
Values - the keyframe values at each point
•
•
•
•
•
•
Infographic Demo
PaintCode, DrawScript
CAKeyframeAnimation
void animateDot () {
CAKeyFrameAnimation keyFrameAnimation = (CAKeyFrameAnimation)CAKeyFrameAnimation.FromKeyPath ("position");
keyFrameAnimation.Path = animationPath.CGPath;
keyFrameAnimation.Duration = 10;
keyFrameAnimation.CalculationMode = CAKeyFrameAnimation.AnimationPaced;
keyFrameAnimation.FillMode = CAFillMode.Forwards;
keyFrameAnimation.TimingFunction = CAMediaTimingFunction.FromName
(CAMediaTimingFunction.Linear);
dot.AddAnimation (keyFrameAnimation, "MoveImage");
dot.Position = new PointF (222, 326);
}
Easing Tweens
Remember This?
http://www.robertpenner.com/easing/
Bounce Demo
Generating Keyframe Values for Easing Equations
No need to specify KeyTimes as keyframes will be dispersed evenly•
public static float EaseOutBounce(float t, float start, float length)
{
if ((t) < (1 / 2.75f))
{
return length * (7.5625f * t * t) + start;
}
else if (t < (2 / 2.75))
{
return length * (7.5625f * (t -= (1.5f / 2.75f)) * t + .75f) + start;
}
else if (t < (2.5 / 2.75))
{
return length * (7.5625f * (t -= (2.25f / 2.75f)) * t + .9375f) + start;
}
else
{
return length * (7.5625f * (t -= (2.625f / 2.75f)) * t + .984375f) + start;
}
}
http://github.com/debreuil/Swf2XNA, , http://www.robertpenner.com/easing/
TweenBuilder
public static NSObject[] CreateKeyValues (float fromValue, float toValue, EasingFormula easingFormula, int
steps = 100)
{
NSObject[] values = new NSObject[steps];
double value = 0;
float curTime = 0;
for (int t = 0; t < steps; t++) {
curTime = (float)t / (float)steps;
var easingFactor = easingFormula(curTime, 0, 1);
value = (toValue - fromValue) * easingFactor + fromValue;
values[t] = NSNumber.FromDouble(value);
}
return values;
}
Using Keyframe Easing Functions
var localMediaTime = CAAnimation.CurrentMediaTime();
NSObject[] keyframes = TweenBuilder.CreateKeyValues(-295, 0, Easing.EaseOutBounce);
var homeIn = new CAKeyFrameAnimation {
KeyPath = "position.x",
Duration = 1.4,
BeginTime = localMediaTime,
FillMode = CAFillMode.Forwards,
RemovedOnCompletion = false,
TimingFunction = CAMediaTimingFunction.FromName(
CAMediaTimingFunction.Linear ),
Values = keyframes
};
navHome.AddAnimation( homeIn, "homeIn" );
If You Can’t Animate It, Fake It
Resources
Resources
WWDC 2010
Core Animation In Practice
https://developer.apple.com/videos/wwdc/2010/?id=424
https://developer.apple.com/videos/wwdc/2010/?id=425
WWDC 2011 - Core Animation Essentials
https://developer.apple.com/videos/wwdc/2011/?id=421
WWDC 2012 - iOS App Performance: Graphics and Animation
https://developer.apple.com/videos/wwdc/2012/?id=238
Delighting Your Users With Core Animation - Frank Krueger
http://www.youtube.com/watch?v=6JePwHjVj6U&noredirect=1
http://www.slideshare.net/Xamarin/delight-your-users-with-coreanimation
About Core Animation
https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CoreAnimation_guide/Introduction/Introduction.html
Robert Penners Easing Functions
http://www.robertpenner.com/easing/
Robin Debreuil’s Swf2XNA Respository
http://github.com/debreuil/Swf2XNA
•
•
•
•
•
•
•
If We Have Time
How to interact with UIView during animation. Notification demo.
How to kill an animation. Attraction Loop demo.
•
•
Thanks!
@davidortinau
http://davidortinau.com
dave@davidortinau.com

More Related Content

What's hot

FMX2013: Butterfly Effect
FMX2013: Butterfly EffectFMX2013: Butterfly Effect
FMX2013: Butterfly EffectRenaldas Zioma
 
Multimedia animation basic concepts
Multimedia   animation basic conceptsMultimedia   animation basic concepts
Multimedia animation basic conceptsDemarch Daguinotas
 
Lec28 29 30 animation
Lec28 29 30 animationLec28 29 30 animation
Lec28 29 30 animationDom Mike
 
3D animation film making
3D animation film making3D animation film making
3D animation film makingAakash Gupta
 
Lecture 9 animation
Lecture 9 animationLecture 9 animation
Lecture 9 animationMr SMAK
 
3D Animation Process and Workflow
3D Animation Process and Workflow3D Animation Process and Workflow
3D Animation Process and WorkflowGridway Digital
 
3D Animation - A Case Study by Seamedu Media School
3D Animation - A Case Study by Seamedu Media School3D Animation - A Case Study by Seamedu Media School
3D Animation - A Case Study by Seamedu Media SchoolSeamedu Media School
 
Animation Film Production Pipeline By : animationgossips.com (Jayant Sharma)
Animation Film Production Pipeline By : animationgossips.com (Jayant Sharma)Animation Film Production Pipeline By : animationgossips.com (Jayant Sharma)
Animation Film Production Pipeline By : animationgossips.com (Jayant Sharma)Jayant Sharma
 
Animate The Web With Ember.js - Jessica Jordan
Animate The Web With Ember.js - Jessica JordanAnimate The Web With Ember.js - Jessica Jordan
Animate The Web With Ember.js - Jessica JordanJessica Jordan
 
Core Animation
Core AnimationCore Animation
Core AnimationBob McCune
 
VFX-An Overview
VFX-An OverviewVFX-An Overview
VFX-An Overviewru_am_vee
 

What's hot (19)

Animation in iOS
Animation in iOSAnimation in iOS
Animation in iOS
 
FMX2013: Butterfly Effect
FMX2013: Butterfly EffectFMX2013: Butterfly Effect
FMX2013: Butterfly Effect
 
Multimedia animation basic concepts
Multimedia   animation basic conceptsMultimedia   animation basic concepts
Multimedia animation basic concepts
 
Computer Generated Graphics
Computer Generated GraphicsComputer Generated Graphics
Computer Generated Graphics
 
Lec28 29 30 animation
Lec28 29 30 animationLec28 29 30 animation
Lec28 29 30 animation
 
ART149_tut_5
ART149_tut_5ART149_tut_5
ART149_tut_5
 
Animation
AnimationAnimation
Animation
 
3D animation film making
3D animation film making3D animation film making
3D animation film making
 
Lecture 9 animation
Lecture 9 animationLecture 9 animation
Lecture 9 animation
 
Animation basics
Animation basicsAnimation basics
Animation basics
 
3D Animation Process and Workflow
3D Animation Process and Workflow3D Animation Process and Workflow
3D Animation Process and Workflow
 
Animation
AnimationAnimation
Animation
 
3D Animation - A Case Study by Seamedu Media School
3D Animation - A Case Study by Seamedu Media School3D Animation - A Case Study by Seamedu Media School
3D Animation - A Case Study by Seamedu Media School
 
Animation Film Production Pipeline By : animationgossips.com (Jayant Sharma)
Animation Film Production Pipeline By : animationgossips.com (Jayant Sharma)Animation Film Production Pipeline By : animationgossips.com (Jayant Sharma)
Animation Film Production Pipeline By : animationgossips.com (Jayant Sharma)
 
Animate The Web With Ember.js - Jessica Jordan
Animate The Web With Ember.js - Jessica JordanAnimate The Web With Ember.js - Jessica Jordan
Animate The Web With Ember.js - Jessica Jordan
 
Core Animation
Core AnimationCore Animation
Core Animation
 
Types of animation
Types of animationTypes of animation
Types of animation
 
Animation
AnimationAnimation
Animation
 
VFX-An Overview
VFX-An OverviewVFX-An Overview
VFX-An Overview
 

Similar to Crafting interactions with Core Animations, David Ortinau

ボタンアニメーションに三角関数を導入して徒労に終わった話
ボタンアニメーションに三角関数を導入して徒労に終わった話ボタンアニメーションに三角関数を導入して徒労に終わった話
ボタンアニメーションに三角関数を導入して徒労に終わった話Naoya Shiga
 
Сергій Міськів, «SwiftUI: Animations»
Сергій Міськів, «SwiftUI: Animations»Сергій Міськів, «SwiftUI: Animations»
Сергій Міськів, «SwiftUI: Animations»Sigma Software
 
다음웹툰의 UX(Animation, Transition, Custom View)
다음웹툰의 UX(Animation, Transition, Custom View)다음웹툰의 UX(Animation, Transition, Custom View)
다음웹툰의 UX(Animation, Transition, Custom View)if kakao
 
Google tools for webmasters
Google tools for webmastersGoogle tools for webmasters
Google tools for webmastersRujata Patil
 
JavaScript Timers, Power Consumption, and Performance
JavaScript Timers, Power Consumption, and PerformanceJavaScript Timers, Power Consumption, and Performance
JavaScript Timers, Power Consumption, and PerformanceNicholas Zakas
 
Hi performance table views with QuartzCore and CoreText
Hi performance table views with QuartzCore and CoreTextHi performance table views with QuartzCore and CoreText
Hi performance table views with QuartzCore and CoreTextMugunth Kumar
 
CocoaHeads Paris - CATransaction: What the flush?!
CocoaHeads Paris - CATransaction: What the flush?!CocoaHeads Paris - CATransaction: What the flush?!
CocoaHeads Paris - CATransaction: What the flush?!amadour
 
Seven Peaks Speaks - Android Jetpack Compose Animation
Seven Peaks Speaks - Android Jetpack Compose AnimationSeven Peaks Speaks - Android Jetpack Compose Animation
Seven Peaks Speaks - Android Jetpack Compose AnimationSeven Peaks Speaks
 
Building animated UI with Core Animation
Building animated UI with Core AnimationBuilding animated UI with Core Animation
Building animated UI with Core AnimationMarco Zoffoli
 
Demystifying Angular Animations
Demystifying Angular AnimationsDemystifying Angular Animations
Demystifying Angular AnimationsGil Fink
 
Open Cv 2005 Q4 Tutorial
Open Cv 2005 Q4 TutorialOpen Cv 2005 Q4 Tutorial
Open Cv 2005 Q4 Tutorialantiw
 
Practical animation
Practical animationPractical animation
Practical animationSV.CO
 
Starting Core Animation
Starting Core AnimationStarting Core Animation
Starting Core AnimationJohn Wilker
 
UI Animations in Meteor
UI Animations in MeteorUI Animations in Meteor
UI Animations in MeteorNick Wientge
 
Programming iOS in C#
Programming iOS in C#Programming iOS in C#
Programming iOS in C#Frank Krueger
 
Leaving Interface Builder Behind
Leaving Interface Builder BehindLeaving Interface Builder Behind
Leaving Interface Builder BehindJohn Wilker
 
How to develop a Graphical User Interface (GUI) in Scilab
How to develop a Graphical User Interface (GUI) in ScilabHow to develop a Graphical User Interface (GUI) in Scilab
How to develop a Graphical User Interface (GUI) in ScilabScilab
 
Lhy tutorial gui(1)
Lhy tutorial gui(1)Lhy tutorial gui(1)
Lhy tutorial gui(1)Brijesh Naik
 

Similar to Crafting interactions with Core Animations, David Ortinau (20)

ボタンアニメーションに三角関数を導入して徒労に終わった話
ボタンアニメーションに三角関数を導入して徒労に終わった話ボタンアニメーションに三角関数を導入して徒労に終わった話
ボタンアニメーションに三角関数を導入して徒労に終わった話
 
Сергій Міськів, «SwiftUI: Animations»
Сергій Міськів, «SwiftUI: Animations»Сергій Міськів, «SwiftUI: Animations»
Сергій Міськів, «SwiftUI: Animations»
 
다음웹툰의 UX(Animation, Transition, Custom View)
다음웹툰의 UX(Animation, Transition, Custom View)다음웹툰의 UX(Animation, Transition, Custom View)
다음웹툰의 UX(Animation, Transition, Custom View)
 
Google tools for webmasters
Google tools for webmastersGoogle tools for webmasters
Google tools for webmasters
 
JavaScript Timers, Power Consumption, and Performance
JavaScript Timers, Power Consumption, and PerformanceJavaScript Timers, Power Consumption, and Performance
JavaScript Timers, Power Consumption, and Performance
 
Hi performance table views with QuartzCore and CoreText
Hi performance table views with QuartzCore and CoreTextHi performance table views with QuartzCore and CoreText
Hi performance table views with QuartzCore and CoreText
 
CocoaHeads Paris - CATransaction: What the flush?!
CocoaHeads Paris - CATransaction: What the flush?!CocoaHeads Paris - CATransaction: What the flush?!
CocoaHeads Paris - CATransaction: What the flush?!
 
Seven Peaks Speaks - Android Jetpack Compose Animation
Seven Peaks Speaks - Android Jetpack Compose AnimationSeven Peaks Speaks - Android Jetpack Compose Animation
Seven Peaks Speaks - Android Jetpack Compose Animation
 
Building animated UI with Core Animation
Building animated UI with Core AnimationBuilding animated UI with Core Animation
Building animated UI with Core Animation
 
Demystifying Angular Animations
Demystifying Angular AnimationsDemystifying Angular Animations
Demystifying Angular Animations
 
Open Cv 2005 Q4 Tutorial
Open Cv 2005 Q4 TutorialOpen Cv 2005 Q4 Tutorial
Open Cv 2005 Q4 Tutorial
 
Practical animation
Practical animationPractical animation
Practical animation
 
Angular animate
Angular animateAngular animate
Angular animate
 
Starting Core Animation
Starting Core AnimationStarting Core Animation
Starting Core Animation
 
UI Animations in Meteor
UI Animations in MeteorUI Animations in Meteor
UI Animations in Meteor
 
Programming iOS in C#
Programming iOS in C#Programming iOS in C#
Programming iOS in C#
 
iOS Core Animation
iOS Core AnimationiOS Core Animation
iOS Core Animation
 
Leaving Interface Builder Behind
Leaving Interface Builder BehindLeaving Interface Builder Behind
Leaving Interface Builder Behind
 
How to develop a Graphical User Interface (GUI) in Scilab
How to develop a Graphical User Interface (GUI) in ScilabHow to develop a Graphical User Interface (GUI) in Scilab
How to develop a Graphical User Interface (GUI) in Scilab
 
Lhy tutorial gui(1)
Lhy tutorial gui(1)Lhy tutorial gui(1)
Lhy tutorial gui(1)
 

More from Xamarin

Xamarin University Presents: Building Your First Intelligent App with Xamarin...
Xamarin University Presents: Building Your First Intelligent App with Xamarin...Xamarin University Presents: Building Your First Intelligent App with Xamarin...
Xamarin University Presents: Building Your First Intelligent App with Xamarin...Xamarin
 
Xamarin University Presents: Ship Better Apps with Visual Studio App Center
Xamarin University Presents: Ship Better Apps with Visual Studio App CenterXamarin University Presents: Ship Better Apps with Visual Studio App Center
Xamarin University Presents: Ship Better Apps with Visual Studio App CenterXamarin
 
Get the Most Out of iOS 11 with Visual Studio Tools for Xamarin
Get the Most Out of iOS 11 with Visual Studio Tools for XamarinGet the Most Out of iOS 11 with Visual Studio Tools for Xamarin
Get the Most Out of iOS 11 with Visual Studio Tools for XamarinXamarin
 
Get the Most out of Android 8 Oreo with Visual Studio Tools for Xamarin
Get the Most out of Android 8 Oreo with Visual Studio Tools for XamarinGet the Most out of Android 8 Oreo with Visual Studio Tools for Xamarin
Get the Most out of Android 8 Oreo with Visual Studio Tools for XamarinXamarin
 
Creative Hacking: Delivering React Native App A/B Testing Using CodePush
Creative Hacking: Delivering React Native App A/B Testing Using CodePushCreative Hacking: Delivering React Native App A/B Testing Using CodePush
Creative Hacking: Delivering React Native App A/B Testing Using CodePushXamarin
 
Build Better Games with Unity and Microsoft Azure
Build Better Games with Unity and Microsoft AzureBuild Better Games with Unity and Microsoft Azure
Build Better Games with Unity and Microsoft AzureXamarin
 
Exploring UrhoSharp 3D with Xamarin Workbooks
Exploring UrhoSharp 3D with Xamarin WorkbooksExploring UrhoSharp 3D with Xamarin Workbooks
Exploring UrhoSharp 3D with Xamarin WorkbooksXamarin
 
Desktop Developer’s Guide to Mobile with Visual Studio Tools for Xamarin
Desktop Developer’s Guide to Mobile with Visual Studio Tools for XamarinDesktop Developer’s Guide to Mobile with Visual Studio Tools for Xamarin
Desktop Developer’s Guide to Mobile with Visual Studio Tools for XamarinXamarin
 
Developer’s Intro to Azure Machine Learning
Developer’s Intro to Azure Machine LearningDeveloper’s Intro to Azure Machine Learning
Developer’s Intro to Azure Machine LearningXamarin
 
Customizing Xamarin.Forms UI
Customizing Xamarin.Forms UICustomizing Xamarin.Forms UI
Customizing Xamarin.Forms UIXamarin
 
Session 4 - Xamarin Partner Program, Events and Resources
Session 4 - Xamarin Partner Program, Events and ResourcesSession 4 - Xamarin Partner Program, Events and Resources
Session 4 - Xamarin Partner Program, Events and ResourcesXamarin
 
Session 3 - Driving Mobile Growth and Profitability
Session 3 - Driving Mobile Growth and ProfitabilitySession 3 - Driving Mobile Growth and Profitability
Session 3 - Driving Mobile Growth and ProfitabilityXamarin
 
Session 2 - Emerging Technologies in your Mobile Practice
Session 2 - Emerging Technologies in your Mobile PracticeSession 2 - Emerging Technologies in your Mobile Practice
Session 2 - Emerging Technologies in your Mobile PracticeXamarin
 
Session 1 - Transformative Opportunities in Mobile and Cloud
Session 1 - Transformative Opportunities in Mobile and Cloud Session 1 - Transformative Opportunities in Mobile and Cloud
Session 1 - Transformative Opportunities in Mobile and Cloud Xamarin
 
SkiaSharp Graphics for Xamarin.Forms
SkiaSharp Graphics for Xamarin.FormsSkiaSharp Graphics for Xamarin.Forms
SkiaSharp Graphics for Xamarin.FormsXamarin
 
Building Games for iOS, macOS, and tvOS with Visual Studio and Azure
Building Games for iOS, macOS, and tvOS with Visual Studio and AzureBuilding Games for iOS, macOS, and tvOS with Visual Studio and Azure
Building Games for iOS, macOS, and tvOS with Visual Studio and AzureXamarin
 
Intro to Xamarin.Forms for Visual Studio 2017
Intro to Xamarin.Forms for Visual Studio 2017Intro to Xamarin.Forms for Visual Studio 2017
Intro to Xamarin.Forms for Visual Studio 2017Xamarin
 
Connected Mobile Apps with Microsoft Azure
Connected Mobile Apps with Microsoft AzureConnected Mobile Apps with Microsoft Azure
Connected Mobile Apps with Microsoft AzureXamarin
 
Introduction to Xamarin for Visual Studio 2017
Introduction to Xamarin for Visual Studio 2017Introduction to Xamarin for Visual Studio 2017
Introduction to Xamarin for Visual Studio 2017Xamarin
 
Building Your First iOS App with Xamarin for Visual Studio
Building Your First iOS App with Xamarin for Visual StudioBuilding Your First iOS App with Xamarin for Visual Studio
Building Your First iOS App with Xamarin for Visual StudioXamarin
 

More from Xamarin (20)

Xamarin University Presents: Building Your First Intelligent App with Xamarin...
Xamarin University Presents: Building Your First Intelligent App with Xamarin...Xamarin University Presents: Building Your First Intelligent App with Xamarin...
Xamarin University Presents: Building Your First Intelligent App with Xamarin...
 
Xamarin University Presents: Ship Better Apps with Visual Studio App Center
Xamarin University Presents: Ship Better Apps with Visual Studio App CenterXamarin University Presents: Ship Better Apps with Visual Studio App Center
Xamarin University Presents: Ship Better Apps with Visual Studio App Center
 
Get the Most Out of iOS 11 with Visual Studio Tools for Xamarin
Get the Most Out of iOS 11 with Visual Studio Tools for XamarinGet the Most Out of iOS 11 with Visual Studio Tools for Xamarin
Get the Most Out of iOS 11 with Visual Studio Tools for Xamarin
 
Get the Most out of Android 8 Oreo with Visual Studio Tools for Xamarin
Get the Most out of Android 8 Oreo with Visual Studio Tools for XamarinGet the Most out of Android 8 Oreo with Visual Studio Tools for Xamarin
Get the Most out of Android 8 Oreo with Visual Studio Tools for Xamarin
 
Creative Hacking: Delivering React Native App A/B Testing Using CodePush
Creative Hacking: Delivering React Native App A/B Testing Using CodePushCreative Hacking: Delivering React Native App A/B Testing Using CodePush
Creative Hacking: Delivering React Native App A/B Testing Using CodePush
 
Build Better Games with Unity and Microsoft Azure
Build Better Games with Unity and Microsoft AzureBuild Better Games with Unity and Microsoft Azure
Build Better Games with Unity and Microsoft Azure
 
Exploring UrhoSharp 3D with Xamarin Workbooks
Exploring UrhoSharp 3D with Xamarin WorkbooksExploring UrhoSharp 3D with Xamarin Workbooks
Exploring UrhoSharp 3D with Xamarin Workbooks
 
Desktop Developer’s Guide to Mobile with Visual Studio Tools for Xamarin
Desktop Developer’s Guide to Mobile with Visual Studio Tools for XamarinDesktop Developer’s Guide to Mobile with Visual Studio Tools for Xamarin
Desktop Developer’s Guide to Mobile with Visual Studio Tools for Xamarin
 
Developer’s Intro to Azure Machine Learning
Developer’s Intro to Azure Machine LearningDeveloper’s Intro to Azure Machine Learning
Developer’s Intro to Azure Machine Learning
 
Customizing Xamarin.Forms UI
Customizing Xamarin.Forms UICustomizing Xamarin.Forms UI
Customizing Xamarin.Forms UI
 
Session 4 - Xamarin Partner Program, Events and Resources
Session 4 - Xamarin Partner Program, Events and ResourcesSession 4 - Xamarin Partner Program, Events and Resources
Session 4 - Xamarin Partner Program, Events and Resources
 
Session 3 - Driving Mobile Growth and Profitability
Session 3 - Driving Mobile Growth and ProfitabilitySession 3 - Driving Mobile Growth and Profitability
Session 3 - Driving Mobile Growth and Profitability
 
Session 2 - Emerging Technologies in your Mobile Practice
Session 2 - Emerging Technologies in your Mobile PracticeSession 2 - Emerging Technologies in your Mobile Practice
Session 2 - Emerging Technologies in your Mobile Practice
 
Session 1 - Transformative Opportunities in Mobile and Cloud
Session 1 - Transformative Opportunities in Mobile and Cloud Session 1 - Transformative Opportunities in Mobile and Cloud
Session 1 - Transformative Opportunities in Mobile and Cloud
 
SkiaSharp Graphics for Xamarin.Forms
SkiaSharp Graphics for Xamarin.FormsSkiaSharp Graphics for Xamarin.Forms
SkiaSharp Graphics for Xamarin.Forms
 
Building Games for iOS, macOS, and tvOS with Visual Studio and Azure
Building Games for iOS, macOS, and tvOS with Visual Studio and AzureBuilding Games for iOS, macOS, and tvOS with Visual Studio and Azure
Building Games for iOS, macOS, and tvOS with Visual Studio and Azure
 
Intro to Xamarin.Forms for Visual Studio 2017
Intro to Xamarin.Forms for Visual Studio 2017Intro to Xamarin.Forms for Visual Studio 2017
Intro to Xamarin.Forms for Visual Studio 2017
 
Connected Mobile Apps with Microsoft Azure
Connected Mobile Apps with Microsoft AzureConnected Mobile Apps with Microsoft Azure
Connected Mobile Apps with Microsoft Azure
 
Introduction to Xamarin for Visual Studio 2017
Introduction to Xamarin for Visual Studio 2017Introduction to Xamarin for Visual Studio 2017
Introduction to Xamarin for Visual Studio 2017
 
Building Your First iOS App with Xamarin for Visual Studio
Building Your First iOS App with Xamarin for Visual StudioBuilding Your First iOS App with Xamarin for Visual Studio
Building Your First iOS App with Xamarin for Visual Studio
 

Recently uploaded

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 

Recently uploaded (20)

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 

Crafting interactions with Core Animations, David Ortinau

  • 2. David Ortinau @davidortinau http://davidortinau.com 17 yrs web, desktop, interactive, mobile. BA English, Maryville University
  • 3.
  • 4.
  • 5.
  • 6. Let’s Talk About Animation Architecture of Core Animation Implicit Animations and Explicit Animations Tweening! Real World Use Cases • • • • •
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14. Interaction Design (IxD) defines the structure and behavior of interactive systems. Interaction Designers strive to create meaningful relationships between people and the products and services that they use, from computers to mobile devices to appliances and beyond.
  • 15. Bill Moggridge’s 3 Questions How do you do? How do you feel? How do you know? 1. 2. 3.
  • 16. Core Animation Makes it Easy UIView.Animate ( duration: 4, animation: () => { notification.Frame = new RectangleF (new PointF (0, 0), notification.Frame.Size); } );
  • 18. https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CoreAnimation_guide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40004514 UIKit / AppKit OpenGL ES / Open GL Graphics Hardware Core Animation Core Graphics CAAnimation CAGroupAnimation CAPropertyAnimation CABasicAnimation CAKeyframeAnimation CATransition CALayer addSubLayer insertSubLayer setNeedsDisplay setNeedsLayout
  • 19. Every UIView has a CALayer UIViews are responsible for interactions CALayers are responsible for what you see • • UIView someView = new UIView(); someView.LayerLayer.Frame = new RectangleF(0, 0, 100, 100);
  • 20. What you see is a compositing of layers UIView CALayer UIView UIView UIImage UILabel UIButton UIButton UIButton UIButton UIButton UIButton UIView CALayer UIView UIButton UIButton UIButton UIButton UIButton UIButton UIView UIImage UILabel
  • 21. CALayer Every UIView has a layer and sets itself as the delegate for that layer CALayer manages visual content and the geometry of that content drawRect creates the layer • • • https://developer.apple.com/library/mac/#documentation/GraphicsImaging/Reference/CALayer_class/Introduction/Introduction.html CALayer someLayer = new CALayer(); someLayer.Frame = new RectangleF(0, 0, 300, 40); someLayer.Contents = UIImage.FromFile('path/to/image.png').CGImage;
  • 23. What Core Animation Provides Interpolation Timing Hardware Accelerated. Animations happen on the GPU. Animations are on a background thread • • • •
  • 25. Animation Rendering Layout is on the CPU. Keep visuals flat for better performance. Animation is on the GPU. • • WWDC Session 238 iOS App Performance: Graphics and Animations 1. Create animation and update view hierarchy 2. Prepare and commit animation 3. Render each frame
  • 27. Implicit Animations of Layer-Backed Views Uses default timing and animation properties UIView must be wrapped in an Animate block UIView Properties Frame Center BackgroundColor Opacity • • • • • • •
  • 29. Animate Block UIView.Animate ( duration: 4, delay: 0, options: UIViewAnimationOptions.CurveEaseIn, animation: () => { notification.Frame = new RectangleF (new PointF (0, 0), notification.Frame.Size); } , completion: null );
  • 31. UIViewAnimationOptions Easing is the pace of the animation over time•
  • 33. UIView.Animate( duration: 1, delay: 0, options: UIViewAnimationOptions.Autoreverse | UIViewAnimationOptions.Repeat, animation: ()=>{ glow.Alpha = 1; } , completion: null );
  • 35. Explicit Animations CABasicAnimation, CAGroupAnimation, CAKeyframeAnimation More fine grain control of the animation Only works on the Layer and doesn’t update the View FillMode = CAFillMode.Forwards RemovedOnCompletion = false Sequence animations Custom animation of your own properties • • • • • • •
  • 36. CABasicAnimation KeyPath - the property to animate BeginTime - when in time to start, can be used to stagger sequenced animations Duration - how long the animation should take, scaled to the timeline of the parent From / To RemoveOnCompletion, FillMode AnimationStopped, AnimationStarted TimingFunction - Linear, EaseIn, EaseOut, EaseInEaseOut • • • • • • •
  • 38. Flow createSlide() - adds or updates CALayer with new images transitionIn() - clears old animations, defines new animations, adds them to layers, Timer calls transitionOut transitionOut() - defines out animations, adds to layers, AnimationStopped signals end cyclesSlides() - increments slide and restarts the loop calling createSlide
  • 39. CABasicAnimation titleImage.RemoveAllAnimations(); var localMediaTime = CAAnimation.CurrentMediaTime(); var titleAnim = CABasicAnimation.FromKeyPath("position.x"); titleAnim.Duration = 1; titleAnim.BeginTime = localMediaTime; titleAnim.From = NSNumber.FromFloat ( 768f ); titleAnim.To = NSNumber.FromFloat ( View.Frame.Width * 0.5f ); titleAnim.RemovedOnCompletion = false; titleAnim.FillMode = CAFillMode.Forwards; titleAnim.TimingFunction = CAMediaTimingFunction.FromName (CAMediaTimingFunction.EaseOut); titleImage.AddAnimation ( titleAnim, "position.x" ); timer = new System.Timers.Timer (); timer.Interval = 5000; timer.Elapsed += (object sender, ElapsedEventArgs e) => { timer.Stop(); InvokeOnMainThread(()=>{ transitionOut(); } ); } ; timer.Start();
  • 40. Everyone Wants to Spin var spinAnim = new CABasicAnimation { KeyPath = "transform.rotation.z", To = NSNumber.FromDouble( Math.PI ), Duration = 0.4, Cumulative = true, RepeatCount = 999 } ; spinner.Layer.AddAnimation( spinAnim, "spinMeRightRoundBabyRightRound" );
  • 41. CAKeyframeAnimation Animate along a path Set keyframes for very fine control of the timing Properties Path - a bezier curve to follow KeyTimes - 1:1 with values, from 0 to 1 over duration Values - the keyframe values at each point • • • • • •
  • 42.
  • 43.
  • 46. CAKeyframeAnimation void animateDot () { CAKeyFrameAnimation keyFrameAnimation = (CAKeyFrameAnimation)CAKeyFrameAnimation.FromKeyPath ("position"); keyFrameAnimation.Path = animationPath.CGPath; keyFrameAnimation.Duration = 10; keyFrameAnimation.CalculationMode = CAKeyFrameAnimation.AnimationPaced; keyFrameAnimation.FillMode = CAFillMode.Forwards; keyFrameAnimation.TimingFunction = CAMediaTimingFunction.FromName (CAMediaTimingFunction.Linear); dot.AddAnimation (keyFrameAnimation, "MoveImage"); dot.Position = new PointF (222, 326); }
  • 51. Generating Keyframe Values for Easing Equations No need to specify KeyTimes as keyframes will be dispersed evenly• public static float EaseOutBounce(float t, float start, float length) { if ((t) < (1 / 2.75f)) { return length * (7.5625f * t * t) + start; } else if (t < (2 / 2.75)) { return length * (7.5625f * (t -= (1.5f / 2.75f)) * t + .75f) + start; } else if (t < (2.5 / 2.75)) { return length * (7.5625f * (t -= (2.25f / 2.75f)) * t + .9375f) + start; } else { return length * (7.5625f * (t -= (2.625f / 2.75f)) * t + .984375f) + start; } } http://github.com/debreuil/Swf2XNA, , http://www.robertpenner.com/easing/
  • 52. TweenBuilder public static NSObject[] CreateKeyValues (float fromValue, float toValue, EasingFormula easingFormula, int steps = 100) { NSObject[] values = new NSObject[steps]; double value = 0; float curTime = 0; for (int t = 0; t < steps; t++) { curTime = (float)t / (float)steps; var easingFactor = easingFormula(curTime, 0, 1); value = (toValue - fromValue) * easingFactor + fromValue; values[t] = NSNumber.FromDouble(value); } return values; }
  • 53. Using Keyframe Easing Functions var localMediaTime = CAAnimation.CurrentMediaTime(); NSObject[] keyframes = TweenBuilder.CreateKeyValues(-295, 0, Easing.EaseOutBounce); var homeIn = new CAKeyFrameAnimation { KeyPath = "position.x", Duration = 1.4, BeginTime = localMediaTime, FillMode = CAFillMode.Forwards, RemovedOnCompletion = false, TimingFunction = CAMediaTimingFunction.FromName( CAMediaTimingFunction.Linear ), Values = keyframes }; navHome.AddAnimation( homeIn, "homeIn" );
  • 54. If You Can’t Animate It, Fake It
  • 56. Resources WWDC 2010 Core Animation In Practice https://developer.apple.com/videos/wwdc/2010/?id=424 https://developer.apple.com/videos/wwdc/2010/?id=425 WWDC 2011 - Core Animation Essentials https://developer.apple.com/videos/wwdc/2011/?id=421 WWDC 2012 - iOS App Performance: Graphics and Animation https://developer.apple.com/videos/wwdc/2012/?id=238 Delighting Your Users With Core Animation - Frank Krueger http://www.youtube.com/watch?v=6JePwHjVj6U&noredirect=1 http://www.slideshare.net/Xamarin/delight-your-users-with-coreanimation About Core Animation https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CoreAnimation_guide/Introduction/Introduction.html Robert Penners Easing Functions http://www.robertpenner.com/easing/ Robin Debreuil’s Swf2XNA Respository http://github.com/debreuil/Swf2XNA • • • • • • •
  • 57. If We Have Time How to interact with UIView during animation. Notification demo. How to kill an animation. Attraction Loop demo. • •