POP: 一个流行的可扩展的动画引擎iOS,它支持spring和衰变动态动画,使其可用于构建现实,基于物理交互。Objective - C API允许快速集成, 对于所有的动画和过渡他是成熟的.

解释:

1.1 POP 使用 Objective-C++ 编写,Objective-C++ 是对 C++ 的扩展,就像 Objective-C 是 C 的扩展。而至于为什么他们用 Objective-C++ 而不是纯粹的 Objective-C. 可能是偏爱。-.O

1.2 POP 目前由四部分组成:1. Animations;2. Engine;3. Utility;4. WebCore。下图有助于你更好的理解它的架构

1.它支持CocoaPods 你可以这样

pod 'pop', '~> 1.0.8'

2.或者这样点击下载拉入工程 https://github.com/facebook/pop

3.我使用的Cocoapods 所以使用之前你需要这样

#import <POP.h>

动图

E1:

- (void)clickPopAction

{

// kPOPLayerPositionY 向下

// kPOPLayerPositionX 向右

POPSpringAnimation *anim = [POPSpringAnimation animationWithPropertyNamed:kPOPLayerPositionY];

// 移动距离

anim.toValue = [[NSNumber alloc] initWithFloat:_btnPop.center.y + 200];

// 从当前 + 1s后开始

anim.beginTime = CACurrentMediaTime() + 1.0f;

// 弹力--晃动的幅度 (springSpeed速度)

anim.springBounciness = 15.0f;

[_btnPop pop_addAnimation:anim forKey:@"position"];

POPSpringAnimation *anim1 = [POPSpringAnimation animationWithPropertyNamed:kPOPLayerBounds];

anim1.toValue = [NSValue valueWithCGRect:CGRectMake(100, 100, 99, 99)];

[_btnPop pop_addAnimation:anim1 forKey:@"size"];

}

动图

E2:在很多金融类app中比较常见、支付宝中的余额包、京东金融余额、就类似这样

// 初始化

POPBasicAnimation *anim = [POPBasicAnimation animation];

// 限时 1s

anim.duration = 3.0;

POPAnimatableProperty * prop = [POPAnimatableProperty propertyWithName:@"count++" initializer:^(POPMutableAnimatableProperty *prop) {

prop.readBlock = ^(id obj, CGFloat values[]){ values[0] = [[obj description] floatValue]; };

prop.writeBlock = ^(id obj, const CGFloat values[])

{

[obj setText:[NSString stringWithFormat:@"%.2f",values[0]]];

};

prop.threshold = 0.01;

}];

anim.property = prop;

anim.fromValue = @(0.0);

anim.toValue = @(1314.52);

[self.xt_countLabel pop_addAnimation:anim forKey:@"counting"];

动图

E3

CALayer *layer0 = [CALayer layer];

layer0.opacity = 1.0;

layer0.transform = CATransform3DIdentity;

[layer0 setMasksToBounds:YES];

[layer0 setBackgroundColor:[UIColor colorWithRed:0.5448 green:0.6836 blue:0.9986 alpha:1.0].CGColor];

[layer0 setCornerRadius:12.5];

[layer0 setBounds:CGRectMake(0, 0, 25, 25)];

[self.view.layer addSublayer:layer0];

layer0.position = CGPointMake(self.view.center.x, 266);

[self performAnimation:layer0];

- (void)performAnimation:(CALayer *)layer

{

[layer pop_removeAllAnimations];

POPBasicAnimation *anim = [POPBasicAnimation animationWithPropertyNamed:kPOPLayerScaleXY];

static BOOL ani = YES;

if (ani) {

anim.toValue = [NSValue valueWithCGPoint:CGPointMake(1.0, 1.0)];

}else{

anim.toValue = [NSValue valueWithCGPoint:CGPointMake(1.5, 1.5)];

}

ani = !ani;

anim.completionBlock = ^(POPAnimation *anim, BOOL finished) {

if (finished) { [self performAnimation:layer]; }

};

[layer pop_addAnimation:anim forKey:@"Animation"];

}

走进 Facebook POP 的世界的更多相关文章

  1. [C#] 走进异步编程的世界 - 开始接触 async/await

    走进异步编程的世界 - 开始接触 async/await 序 这是学习异步编程的入门篇. 涉及 C# 5.0 引入的 async/await,但在控制台输出示例时经常会采用 C# 6.0 的 $&qu ...

  2. [C#] 走进异步编程的世界 - 剖析异步方法(上)

    走进异步编程的世界 - 剖析异步方法(上) 序 这是上篇<走进异步编程的世界 - 开始接触 async/await 异步编程>(入门)的第二章内容,主要是与大家共同深入探讨下异步方法. 本 ...

  3. [C#] 走进异步编程的世界 - 剖析异步方法(下)

    走进异步编程的世界 - 剖析异步方法(下) 序 感谢大家的支持,这是昨天发布<走进异步编程的世界 - 剖析异步方法(上)>的补充篇. 目录 异常处理 在调用方法中同步等待任务 在异步方法中 ...

  4. [C#] 走进异步编程的世界 - 在 GUI 中执行异步操作

    走进异步编程的世界 - 在 GUI 中执行异步操作 [博主]反骨仔 [原文地址]http://www.cnblogs.com/liqingwen/p/5877042.html 序 这是继<开始接 ...

  5. 走进异步编程的世界 - 开始接触 async/await

    [C#] 走进异步编程的世界 - 开始接触 async/await   走进异步编程的世界 - 开始接触 async/await 序 这是学习异步编程的入门篇. 涉及 C# 5.0 引入的 async ...

  6. iOS开发Facebook POP动效库使用教程

    如果说Origami这款动效原型工具是Facebook Paper的幕后功臣,那么POP便是Origami的地基.感谢Facebook开源了POP动效库,让人人都能制作出华丽的动效.我们只需5步,便能 ...

  7. [C#] 走进异步编程的世界 - 开始接触 async/await(转)

    原文链接:http://www.cnblogs.com/liqingwen/p/5831951.html 走进异步编程的世界 - 开始接触 async/await 序 这是学习异步编程的入门篇. 涉及 ...

  8. Miox带你走进动态路由的世界——51信用卡前端团队

    写在前面: 有的时候再做大型项目的时候,确实会被复杂的路由逻辑所烦恼,会经常遇到权限问题,路由跳转回退逻辑问题.这几天在网上看到了51信用卡团队开源了一个Miox,可以有效的解决这些痛点,于是乎我就做 ...

  9. 走进异步编程的世界 - 开始接触 async/await(转)

    序 这是学习异步编程的入门篇. 涉及 C# 5.0 引入的 async/await,但在控制台输出示例时经常会采用 C# 6.0 的 $"" 来拼接字符串,相当于string.Fo ...

随机推荐

  1. c++的四种强制类型转换

    http://hb.qq.com/a/20110722/001452.htm ...... C风格的强制类型转换(Type Cast)很简单,不管什么类型的转换统统是:TYPE b = (TYPE)a ...

  2. jsp表单提交中文乱码的解决

    <%@ page language="Java" contentType="text/html; charset=utf-8 "    pageEncod ...

  3. Xstream之常用方式与常用注解

    示例代码 Blog teamBlog = new Blog(new Author("Guilherme Silveira")); teamBlog.add(new Entry(&q ...

  4. 14.5.5.1 An InnoDB Deadlock Example 一个InnoDB 死锁实例

    14.5.5.1 An InnoDB Deadlock Example 一个InnoDB 死锁实例 下面的例子演示了一个错误可以发生当一个lock 请求会导致一个死锁,例子设计2个客户端,A和B: J ...

  5. 事务Isolation Level 例子详解

    举例分析: 我们有A表, 包含两条数据. Read uncommitted: 假设我们有两个事务 Trans1, Trans2. 它们的操作如下: Trans 1: 更新A1 -> A11, 然 ...

  6. 【HDOJ】2255 奔小康赚大钱

    最大二分图匹配,O(n^3). /* 2255 */ #include <iostream> #include <algorithm> #include <cstdio& ...

  7. 【转】Linux下svn的常用工作流程

    原文网址:http://www.cnblogs.com/cobbliu/archive/2011/07/08/2389011.html 上篇文章在ubuntu和redhat5.5上搭建好了svnser ...

  8. Linux下如何挂载FAT32格式USB设备

    挂u盘之前,运行命令cat /proc/partitions,看看现在系统中有哪些分区.插上u盘以后,再次运行上述命令,看看多出来什么分区.通常是sda1. 1.插入U盘 2.输入 fdisk -l ...

  9. Hash(4) hashtable,hashmap

    首先,我们要知道set是利使用map是实现的,因为只要利用map中的key唯一性就行了. 1.hashmap 和hashtable的区别是什么? 我们可以背出:  hashtable线程安全.hash ...

  10. Reachability几个常用方法

    http://oncerios.diandian.com/post/2013-06-28/40050041969