+ All Categories
Home > Technology > Introduction to POP animation engine

Introduction to POP animation engine

Date post: 15-May-2015
Category:
Upload: subhransu-behera
View: 1,316 times
Download: 0 times
Share this document with a friend
Description:
Introduction to POP animation engine. POP drives all the animations and transitions in Facebook's Paper application. POP reference link: https://github.com/facebook/pop Sample iOS Project: https://github.com/subhransu/PopAnimation-Sample
Popular Tags:
16
animate Subhransu Behera - [email protected] with
Transcript
Page 1: Introduction to POP animation engine

animateSubhransu Behera - [email protected]

with

Page 2: Introduction to POP animation engine

what’s pop

• An animation engine for iOS and OSX

• It supports spring and dynamic animations

• Useful for realistic and physic based interactions

• Facebook used it extensibly in their Paper app

Page 3: Introduction to POP animation engine

http://facebook.com/paper

Page 4: Introduction to POP animation engine

installation

• Recommended way of installing pop is to use CocoaPods

• pod 'pop', '~> 1.0’

• Ensure -lc++ linker flag is set for manual installation

Page 5: Introduction to POP animation engine

installation• To install Cocoapods

!$ sudo gem install cocoapods

• Create Podfile file in your Xcode project and write !platform: iOS, ‘7.0' pod 'pop', '~> 1.0’

• Install your dependencies !

$ pod install

• Make sure you open the Xcode workspace instead of the project file

!$ open App.xcworkspace!!

Page 6: Introduction to POP animation engine

using pop• Import the header file ! #import <POP/POP.h>

• To start an animation add it to an object // sample code POPSpringAnimation *anim = [POPSpringAnimation animation]; … ! [layer pop_addAnimation:anim forKey:@"myKey"];

Page 7: Introduction to POP animation engine

using pop• To stop an animation

! [layer pop_removeAnimationForKey:@"myKey"]; !

• Check existence of an animation using key ! // Sample code ! anim = [layer pop_animationForKey:@"myKey"]; ! if (anim) { // Do something }

Page 8: Introduction to POP animation engine

animation types

• Spring

• Decay

• Basic

• Custom

Page 9: Introduction to POP animation engine

spring animation

• gives objects a delightful bouncy effects ! // Sample code !

POPSpringAnimation *anim = [POPSpringAnimation animationWithPropertyNamed:kPOPLayerBounds]; !

anim.toValue = [NSValue valueWithCGRect:CGRectMake(0, 0, 400, 400)]; ! [layer pop_addAnimation:anim forKey:@"size"];

Page 10: Introduction to POP animation engine

decay animation

• gradually slows an object to halt ! // sample code POPDecayAnimation *anim = [POPDecayAnimation animationWithPropertyNamed:kPOPLayerPositionX]; ! anim.velocity = @(1000.); ! [layer pop_addAnimation:anim forKey:@"slide"];

Page 11: Introduction to POP animation engine

basic animation• used to interpolate values over a specified time period ! // sample code POPBasicAnimation *anim = [POPBasicAnimation animationWithPropertyNamed:kPOPViewAlpha]; anim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; anim.fromValue = @(0.0); anim.toValue = @(1.0); [view pop_addAnimation:anim forKey:@"fade"];

Page 12: Introduction to POP animation engine

properties• Property animated is specified by

POPAnimatableProperty class !// kPopLayerBounds sets the property to [CALayer bounds]

POPSpringAnimation *anim = [POPSpringAnimation animation]; ! anim.property = [POPAnimatableProperty propertyWithName:kPOPLayerBounds];

Page 13: Introduction to POP animation engine

Demo https://github.com/subhransu/

PopAnimation-Sample

Page 14: Introduction to POP animation engine

resources• GitHub: https://github.com/facebook/pop

• POP Tutorial in 5 Steps: https://github.com/maxmyers/FacebookPop

• https://github.com/hfossli/aggeometrykit-pop

• POP Playground: https://github.com/callmeed/pop-playground

Page 15: Introduction to POP animation engine

video tutorials• Getting Started: http://www.youtube.com/watch?

v=Ta5AD8dHbmQ

• Live Button: http://www.youtube.com/watch?v=586eOCu3b28

• Custom Segue: http://www.youtube.com/watch?v=586eOCu3b28

• Basic Button Animation: http://www.youtube.com/watch?v=ErJ4FnPa_Qk

Page 16: Introduction to POP animation engine

Join our Facebook group to know more about iOS Dev Scout

Subhransu Behera - [email protected]

https://www.facebook.com/groups/iosdevscout


Recommended