ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
Animations in iOS with
Facebook POP
Eduard Panasiuk
Minsk 2015
@edpanasiuk github.com/somedev ed.iosdev@gmail.com
https://github.com/facebook/pop
Pop is animation library for iOS and OS X. 

Made by Facebook team for Paper app.

Written in C++/ObjectiveC++

Timer-based animation (via CADisplayLink)

Well documented and tested

Works with Swift
Features
? Simple API (almost identical to Core Animation)
POPSpringAnimation *springAnimation =
[POPSpringAnimation animationWithPropertyNamed:kPOPLayerBounds];
springAnimation.springBounciness = 14;
springAnimation.springSpeed = 3;
springAnimation.toValue = [NSValue valueWithCGRect:CGRectMake(0, 0, 400,
400)];
[layer pop_addAnimation:springAnimation forKey:@"size"];
...
[layer pop_removeAnimationForKey:@"size"];
/* completion block */
springAnimation.completionBlock = ^(POPAnimation *anAnimation, BOOL
finished) {
NSLog(@"Animation has completed.");
};
Features
? Update animation on the ?y
POPSpringAnimation *animation = [layer pop_animationForKey:@"myKey"];
if (animation) {
/* update to value to new destination */
animation.toValue = @(42.0);
} else {
/* create and start a new animation */
....
}
Features
? Pop can animate any property of any Objective-
C object
POPAnimatableProperty *prop =
[POPAnimatableProperty propertyWithName:@"com.foo.radio.volume"
initializer:^(POPMutableAnimatableProperty *property) {
// read value
prop.readBlock = ^(id obj, CGFloat values[]) {
values[0] = [obj volume];
};
// write value
prop.writeBlock = ^(id obj, const CGFloat values[]) {
[obj setVolume:values[0]];
};
// dynamics threshold
prop.threshold = 0.01;
}]
Animation Types
POPBasicAnimation
¡­ and other, using custom CAMediaTimingFunction
POPBasicAnimation *basicAnimation = [POPBasicAnimation animation];
basicAnimation.timingFunction = [CAMediaTimingFunction
functionWithName:kCAMediaTimingFunctionLinear];
basicAnimation.duration = 0.5;
Animation Types
POPSpringAnimation
POPDecayAnimation
POPSpringAnimation *springAnimation = [POPSpringAnimation animation];
// change of value units per second
springAnimation.velocity = @(1000);
// value between 0-20 default at 4
springAnimation.springBounciness = 14;
// value between 0-20 default at 4
springAnimation.springSpeed = 3;
POPDecayAnimation *decayAnimation = [POPDecayAnimation animation];
//change of value units per second
decayAnimation.velocity = @(233);
//range of 0 to 1
decayAnimation.deceleration = .833;
Animation Types
POPCustomAnimation
// Return NO when animation finished
typedef BOOL (^POPCustomAnimationBlock)(id target, POPCustomAnimation
*animation);
// The current animation time at time of callback.
@property (readonly, nonatomic) CFTimeInterval currentTime;
//The elapsed animation time since last callback.
@property (readonly, nonatomic) CFTimeInterval elapsedTime;
Examples
https://github.com/schneiderandre/popping
Demo (Swift)
https://github.com/somedev/animations-in-ios
Drawbacks
Should you use POP? - perfect article from Vladislav
Alexeev (iOS engineer in Facebook UK)
Fig.1. Perfomance. Rotation layer across X axis
with perspective (10 seconds)
Drawbacks
https://medium.com/@beefon/should-you-use-pop-
b986b10d4079
Fig.2. CoreAnimation (left) vs POP(right) when main thread is
periodically blocking
Conclusion
+ -
Simple and powerful API Runs on Main Thread
Animate any property of any
object
More CPU load during
animation
Built in dynamic animations
Chance to get UI lag during
animation
Custom animations

More Related Content

Similar to Animations in iOS with Facebook POP (7)

PDF
Animate The Web With Ember.js - Jessica Jordan
Jessica Jordan
?
PDF
Randomising css animations
asjb
?
PPTX
React native introduction
InnerFood
?
PPTX
Animations avec Compose : rendez vos apps chat-oyantes
Antoine Robiez
?
PPTX
React native introduction
InnerFood
?
PDF
Crafting interactions with Core Animations, David Ortinau
Xamarin
?
PDF
Animations in Flutter
Bartosz Kosarzycki
?
Animate The Web With Ember.js - Jessica Jordan
Jessica Jordan
?
Randomising css animations
asjb
?
React native introduction
InnerFood
?
Animations avec Compose : rendez vos apps chat-oyantes
Antoine Robiez
?
React native introduction
InnerFood
?
Crafting interactions with Core Animations, David Ortinau
Xamarin
?
Animations in Flutter
Bartosz Kosarzycki
?

Recently uploaded (20)

PDF
From Data Preparation to Inference: How Alluxio Speeds Up AI
Alluxio, Inc.
?
PPTX
arctitecture application system design os dsa
za241967
?
PDF
Best Practice for LLM Serving in the Cloud
Alluxio, Inc.
?
PPTX
IObit Driver Booster Pro 12 Crack Latest Version Download
pcprocore
?
PPTX
IDM Crack with Internet Download Manager 6.42 [Latest 2025]
HyperPc soft
?
PPTX
Wondershare Filmora Crack 14.5.18 + Key Full Download [Latest 2025]
HyperPc soft
?
PPTX
Android Notifications-A Guide to User-Facing Alerts in Android .pptx
Nabin Dhakal
?
PPTX
Introduction to web development | MERN Stack
JosephLiyon
?
PPTX
declaration of Variables and constants.pptx
meemee7378
?
PDF
IObit Uninstaller Pro 14.3.1.8 Crack for Windows Latest
utfefguu
?
PDF
Code Once; Run Everywhere - A Beginner¡¯s Journey with React Native
Hasitha Walpola
?
PDF
Telemedicine App Development_ Key Factors to Consider for Your Healthcare Ven...
Mobilityinfotech
?
PPTX
CV-Project_2024 version 01222222222.pptx
MohammadSiddiqui70
?
PDF
Rewards and Recognition (2).pdf
ethan Talor
?
DOCX
Best AI-Powered Wearable Tech for Remote Health Monitoring in 2025
SEOLIFT - SEO Company London
?
PPTX
Foundations of Marketo Engage - Programs, Campaigns & Beyond - June 2025
BradBedford3
?
PPTX
Iobit Driver Booster Pro 12 Crack Free Download
chaudhryakashoo065
?
PDF
TEASMA: A Practical Methodology for Test Adequacy Assessment of Deep Neural N...
Lionel Briand
?
PPTX
IObit Uninstaller Pro 14.3.1.8 Crack Free Download 2025
sdfger qwerty
?
PDF
Mastering VPC Architecture Build for Scale from Day 1.pdf
Devseccops.ai
?
From Data Preparation to Inference: How Alluxio Speeds Up AI
Alluxio, Inc.
?
arctitecture application system design os dsa
za241967
?
Best Practice for LLM Serving in the Cloud
Alluxio, Inc.
?
IObit Driver Booster Pro 12 Crack Latest Version Download
pcprocore
?
IDM Crack with Internet Download Manager 6.42 [Latest 2025]
HyperPc soft
?
Wondershare Filmora Crack 14.5.18 + Key Full Download [Latest 2025]
HyperPc soft
?
Android Notifications-A Guide to User-Facing Alerts in Android .pptx
Nabin Dhakal
?
Introduction to web development | MERN Stack
JosephLiyon
?
declaration of Variables and constants.pptx
meemee7378
?
IObit Uninstaller Pro 14.3.1.8 Crack for Windows Latest
utfefguu
?
Code Once; Run Everywhere - A Beginner¡¯s Journey with React Native
Hasitha Walpola
?
Telemedicine App Development_ Key Factors to Consider for Your Healthcare Ven...
Mobilityinfotech
?
CV-Project_2024 version 01222222222.pptx
MohammadSiddiqui70
?
Rewards and Recognition (2).pdf
ethan Talor
?
Best AI-Powered Wearable Tech for Remote Health Monitoring in 2025
SEOLIFT - SEO Company London
?
Foundations of Marketo Engage - Programs, Campaigns & Beyond - June 2025
BradBedford3
?
Iobit Driver Booster Pro 12 Crack Free Download
chaudhryakashoo065
?
TEASMA: A Practical Methodology for Test Adequacy Assessment of Deep Neural N...
Lionel Briand
?
IObit Uninstaller Pro 14.3.1.8 Crack Free Download 2025
sdfger qwerty
?
Mastering VPC Architecture Build for Scale from Day 1.pdf
Devseccops.ai
?
Ad

Animations in iOS with Facebook POP

  • 1. Animations in iOS with Facebook POP Eduard Panasiuk Minsk 2015 @edpanasiuk github.com/somedev ed.iosdev@gmail.com
  • 2. https://github.com/facebook/pop Pop is animation library for iOS and OS X. Made by Facebook team for Paper app. Written in C++/ObjectiveC++ Timer-based animation (via CADisplayLink) Well documented and tested Works with Swift
  • 3. Features ? Simple API (almost identical to Core Animation) POPSpringAnimation *springAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPLayerBounds]; springAnimation.springBounciness = 14; springAnimation.springSpeed = 3; springAnimation.toValue = [NSValue valueWithCGRect:CGRectMake(0, 0, 400, 400)]; [layer pop_addAnimation:springAnimation forKey:@"size"]; ... [layer pop_removeAnimationForKey:@"size"]; /* completion block */ springAnimation.completionBlock = ^(POPAnimation *anAnimation, BOOL finished) { NSLog(@"Animation has completed."); };
  • 4. Features ? Update animation on the ?y POPSpringAnimation *animation = [layer pop_animationForKey:@"myKey"]; if (animation) { /* update to value to new destination */ animation.toValue = @(42.0); } else { /* create and start a new animation */ .... }
  • 5. Features ? Pop can animate any property of any Objective- C object POPAnimatableProperty *prop = [POPAnimatableProperty propertyWithName:@"com.foo.radio.volume" initializer:^(POPMutableAnimatableProperty *property) { // read value prop.readBlock = ^(id obj, CGFloat values[]) { values[0] = [obj volume]; }; // write value prop.writeBlock = ^(id obj, const CGFloat values[]) { [obj setVolume:values[0]]; }; // dynamics threshold prop.threshold = 0.01; }]
  • 6. Animation Types POPBasicAnimation ¡­ and other, using custom CAMediaTimingFunction POPBasicAnimation *basicAnimation = [POPBasicAnimation animation]; basicAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; basicAnimation.duration = 0.5;
  • 7. Animation Types POPSpringAnimation POPDecayAnimation POPSpringAnimation *springAnimation = [POPSpringAnimation animation]; // change of value units per second springAnimation.velocity = @(1000); // value between 0-20 default at 4 springAnimation.springBounciness = 14; // value between 0-20 default at 4 springAnimation.springSpeed = 3; POPDecayAnimation *decayAnimation = [POPDecayAnimation animation]; //change of value units per second decayAnimation.velocity = @(233); //range of 0 to 1 decayAnimation.deceleration = .833;
  • 8. Animation Types POPCustomAnimation // Return NO when animation finished typedef BOOL (^POPCustomAnimationBlock)(id target, POPCustomAnimation *animation); // The current animation time at time of callback. @property (readonly, nonatomic) CFTimeInterval currentTime; //The elapsed animation time since last callback. @property (readonly, nonatomic) CFTimeInterval elapsedTime;
  • 11. Drawbacks Should you use POP? - perfect article from Vladislav Alexeev (iOS engineer in Facebook UK) Fig.1. Perfomance. Rotation layer across X axis with perspective (10 seconds)
  • 13. Conclusion + - Simple and powerful API Runs on Main Thread Animate any property of any object More CPU load during animation Built in dynamic animations Chance to get UI lag during animation Custom animations