FaceBook pop 动画开源框架使用教程说明
https://github.com/facebook/pop

Pop is an extensible animation engine for iOS and OS X. In addition to basic static animations, it supports spring and decay dynamic animations, making it useful for building realistic, physics-based interactions. The API allows quick integration with existing Objective-C codebases and enables the animation of any property on any object. It's a mature and well-tested framework that drives all the animations and transitions in Paper.
POPdemo
A simple demo for facebook's pop framework.
pop一共有四个大类
POPSpringAnimation 有弹性效果的动画类(个人比较喜欢这个)
POPBasicAnimation 基本动画类
POPDecayAnimation 衰减动画类
POPCustomAnimation 可以自定义动画的类
导入pop
很简单,直接把pop文件夹拖到项目里,然后导入pop.h即可。
#import "POP.h"
下面的代码示例用POPSpringAnimation做一个弹性放大-缩小的效果
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib. //添加手势
UITapGestureRecognizer *gestureForSpring = [[UITapGestureRecognizer alloc] init];
[gestureForSpring addTarget:self action:@selector(changeSize:)];
[_springView addGestureRecognizer:gestureForSpring]; } - (void)changeSize:(UITapGestureRecognizer*)tap{
-
//用POPSpringAnimation 让viewBlue实现弹性放大缩小的效果
POPSpringAnimation *springAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPLayerSize]; CGRect rect = _springView.frame;
if (rect.size.width==100) {
springAnimation.toValue = [NSValue valueWithCGSize:CGSizeMake(300, 300)];
}
else{
springAnimation.toValue = [NSValue valueWithCGSize:CGSizeMake(100, 100)];
} //弹性值
springAnimation.springBounciness = 20.0;
//弹性速度
springAnimation.springSpeed = 20.0; [_springView.layer pop_addAnimation:springAnimation forKey:@"changesize"]; }
效果如下

上面的代码是改变view的size,下面示例改变position
POPSpringAnimation *springAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPLayerPosition];
CGPoint point = _springView.center;
if (point.y==240) {
springAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(point.x, -230)];
}
else{
springAnimation.toValue = [NSValue valueWithCGSize:CGSizeMake(point.x, 240)];
}
//弹性值
springAnimation.springBounciness = 20.0;
//弹性速度
springAnimation.springSpeed = 20.0;
[_springView pop_addAnimation:springAnimation forKey:@"changeposition"];
效果:

这个效果可以做一个弹出框从上往下跳出来,我之前做过这个效果,用了N多代码,用pop只用几句代码就实现了。
一个比较实用的效果,弹出菜单:

代码如下:
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"+" style:UIBarButtonItemStyleDone target:self action:@selector(showPop)];
- (void)showPop{
if (_isOpened) {
[self hidePop];
return;
}
_isOpened = YES;
POPSpringAnimation *positionAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPViewFrame];
positionAnimation.fromValue = [NSValue valueWithCGRect:_hidePosition];
positionAnimation.toValue = [NSValue valueWithCGRect:_showPosition];
positionAnimation.springBounciness = 15.0f;
positionAnimation.springSpeed = 20.0f;
[_popView pop_addAnimation:positionAnimation forKey:@"frameAnimation"];
}
- (void)hidePop{
POPBasicAnimation *positionAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewFrame];
positionAnimation.fromValue = [NSValue valueWithCGRect:_showPosition];
positionAnimation.toValue = [NSValue valueWithCGRect:_hidePosition];
//key一样就会用后面的动画覆盖之前的
[_popView pop_addAnimation:positionAnimation forKey:@"frameAnimation"];
_isOpened = NO;
}
FaceBook pop 动画开源框架使用教程说明的更多相关文章
- iOS开发Facebook POP动效库使用教程
如果说Origami这款动效原型工具是Facebook Paper的幕后功臣,那么POP便是Origami的地基.感谢Facebook开源了POP动效库,让人人都能制作出华丽的动效.我们只需5步,便能 ...
- Facebook POP动效库使用教程
编者注:用Origami作iOS动效的同学如果愁怎么实现,可以把这个给开发看看作为参考哦 如果说Origami这款动效原型工具是Facebook Paper的幕后功臣,那么POP便是Origami的地 ...
- [翻译] POP Facebook的动画开源库
Pop is an extensible animation engine for iOS and OS X. In addition to basic static animations, it s ...
- android gif动画开源框架android-gif-drawable
地址:https://github.com/koral--/android-gif-drawable github里介绍挺详细的 项目中需要显示gif图片,并对用户体验有较高的要求,之前一直在使用 ...
- iOS - 开源框架、项目和学习资料汇总(动画篇)
动画 1. Core Animation笔记,基本的使用方法 – Core Animation笔记,基本的使用方法:1.基本动画,2.多步动画,3.沿路径的动画,4.时间函数,5.动画组.2. awe ...
- Android绘图机制(四)——使用HelloCharts开源框架搭建一系列炫酷图表,柱形图,折线图,饼状图和动画特效,抽丝剥茧带你认识图表之美
Android绘图机制(四)--使用HelloCharts开源框架搭建一系列炫酷图表,柱形图,折线图,饼状图和动画特效,抽丝剥茧带你认识图表之美 这里为什么不继续把自定义View写下去呢,因为最近项目 ...
- Farseer.net轻量级ORM开源框架 V1.x 教程目录
本篇教程将以Ver 1.x版本进行详细使用讲解 大家有任何疑问可以加入我们的官方QQ群进行讨论.QQ群:116228666 (Farseer.net开源框架交流) 请注明:Farseer.Net 整个 ...
- facebook打开动画pop
POP源代码:https://github.com/facebook/pop demo相关链接:https://github.com/jxd001/POPdemo/blob/master/README ...
- iOS常用第三方开源框架和优秀开发者博客等
博客收藏iOS开发过程好的开源框架.开源项目.Xcode工具插件.Mac软件.文章等,会不断更新维护,希望对你们有帮助.如果有推荐或者建议,请到此处提交推荐或者联系我. 该文档已提交GitHub,点击 ...
随机推荐
- [工作笔记]JDK版本不同导致的SSL异常
前言 遇到这个问题得说一下笔者的开发环境,笔者所在公司,平时开发用的web容器是jboss,使用的JDK是oracle的JDK,但是测试和生产环境用的是WAS,JDK用的是IBM的JDK,由于项目的不 ...
- ASP.NET Core MVC 2.x 全面教程_ASP.NET Core MVC 25. 过滤器
在MVC的请求管道 并不是 asp.net core的请求管道.所以说Filter是专用于MVC的 贯穿特性,横穿关注点.比如授权.日志 这里的Authorize其实就是一个Filter,主要用来授 ...
- java8--List转为Map、分组、过滤、求和等操作
利用java8新特性,可以用简洁高效的代码来实现一些数据处理~ 定义1个Apple对象: public class Apple { private Integer id; private String ...
- OpenCV入门指南
http://blog.csdn.net/morewindows/article/details/8225783/ http://blog.csdn.net/poem_qianmo/article/d ...
- laravel MVC分布及数据库配置
laravel MVC分布 M app\Http\Middleware V resources\views C app\Http\Controllers 数据库配置 目录 config\datab ...
- 洛谷P4717 【模板】快速沃尔什变换(FWT)
传送门 这玩意儿太骚了…… 参考了yyb巨佬的 //minamoto #include<iostream> #include<cstdio> #define ll long l ...
- js对象 数组Array详解 (参照MDN官网:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find)
一:数组的创建方式: 1.采用直接量创建 var arr = [];//创建一个空数组 var arr2 = [1,2,3];//创建一个有三个元素的数组 2.采用构造函数创建 a.var arr1 ...
- 覆盖equals方法时请遵守通用约定
覆盖equals方法时请遵守通用约定 覆盖equals方法看起来很简单,但是有许多覆盖方式会导致错误,并且后果很严重.最容易避免这种类问题的方法就是不覆盖equals方法,在这种情况下,类的每个实 ...
- spark sql 优化心得
本篇文章主要记录最近在使用spark sql 时遇到的问题已经使用心得. 1 spark 2.0.1 中,启动thriftserver 或者是spark-sql时,如果希望spark-sql run ...
- 基于java开发的在线题库系统tamguo
简介 探果网(简称tamguo)是基于java开发的在线题库系统,包括 在线访问 后台运营 会员中心 书籍中心 管理员账号:system 密码:123456 因为线上数据和测试数据没有做到隔离,作者已 ...