Facebook 开源动画库 pop
一:pop的基本构成:
POPPropertyAnimation 属性动画
POPSpringAnimation 弹簧效果动画
POPBasicAnimation 基于动画
POPDecayAnimation 延迟衰减动画
POPCustomAnimation 自定义动画
二:其中属性动画的类型:
#pragma mark - Static NSString * const kPOPLayerBackgroundColor = @"backgroundColor";
NSString * const kPOPLayerBounds = @"bounds";
NSString * const kPOPLayerOpacity = @"opacity";
NSString * const kPOPLayerPosition = @"position";
NSString * const kPOPLayerPositionX = @"positionX";
NSString * const kPOPLayerPositionY = @"positionY";
NSString * const kPOPLayerRotation = @"rotation";
NSString * const kPOPLayerRotationX = @"rotationX";
NSString * const kPOPLayerRotationY = @"rotationY";
NSString * const kPOPLayerScaleX = @"scaleX";
NSString * const kPOPLayerScaleXY = @"scaleXY";
NSString * const kPOPLayerScaleY = @"scaleY";
NSString * const kPOPLayerSize = @"size";
NSString * const kPOPLayerSubscaleXY = @"subscaleXY";
NSString * const kPOPLayerSubtranslationX = @"subtranslationX";
NSString * const kPOPLayerSubtranslationXY = @"subtranslationXY";
NSString * const kPOPLayerSubtranslationY = @"subtranslationY";
NSString * const kPOPLayerSubtranslationZ = @"subtranslationZ";
NSString * const kPOPLayerTranslationX = @"translationX";
NSString * const kPOPLayerTranslationXY = @"translationXY";
NSString * const kPOPLayerTranslationY = @"translationY";
NSString * const kPOPLayerTranslationZ = @"translationZ";
NSString * const kPOPLayerZPosition = @"zPosition"; NSString * const kPOPViewAlpha = @"view.alpha";
NSString * const kPOPViewBackgroundColor = @"view.backgroundColor";
NSString * const kPOPViewBounds = kPOPLayerBounds;
NSString * const kPOPViewCenter = @"view.center";
NSString * const kPOPViewFrame = @"view.frame";
NSString * const kPOPViewScaleX = @"view.scaleX";
NSString * const kPOPViewScaleXY = @"view.scaleXY";
NSString * const kPOPViewScaleY = @"view.scaleY";
NSString * const kPOPViewSize = kPOPLayerSize; NSString * const kPOPTableViewContentOffset = @"tableView.contentOffset";
NSString * const kPOPTableViewContentSize = @"tableView.contentSize";
使用:
POPSpringAnimation *springAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPLayerSize];
三:
示例1:演示图片放大效果动画
@interface PPPictureConstraintViewController ()
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *widthConstraint;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *heightConstraint; @end @implementation PPPictureConstraintViewController - (void)performFullScreenAnimation
{
//先去除所有的动画
[self.widthConstraint pop_removeAllAnimations];
[self.heightConstraint pop_removeAllAnimations]; //创建弹簧动画1
POPSpringAnimation *heightAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPLayoutConstraintConstant];
heightAnimation.springBounciness = ; //创建弹簧动画2
POPSpringAnimation *animation = [POPSpringAnimation animationWithPropertyNamed:kPOPLayoutConstraintConstant];
animation.springBounciness = ; if (!_isInFullscreen)
{
animation.toValue = @(.);
heightAnimation.toValue = @(.);
}
else
{
animation.toValue = @(.);
heightAnimation.toValue = @(.);
} //加载动画
[self.heightConstraint pop_addAnimation:heightAnimation forKey:@"fullscreen"];
[self.widthConstraint pop_addAnimation:animation forKey:@"fullscreen"]; } @end
示例2:创建一个旋转及点击放大 + 号 动画
- (IBAction)bigBounceButtonWasPressed:(UIButton *)sender
{
_buttonToggle = !_buttonToggle; CALayer *layer = sender.layer; [layer pop_removeAllAnimations];
POPSpringAnimation *anim = [POPSpringAnimation animationWithPropertyNamed:kPOPLayerSize];
POPSpringAnimation *rotation = [POPSpringAnimation animationWithPropertyNamed:kPOPLayerRotation]; if (_buttonToggle)
{
anim.toValue = [NSValue valueWithCGSize:CGSizeMake(, )];
rotation.toValue = @(M_PI_4);
sender.tintColor = [UIColor colorWithRed:0.0 green:122.0/255.0 blue:1.0 alpha:1.0];
}
else
{
anim.toValue = [NSValue valueWithCGSize:CGSizeMake(, )];
rotation.toValue = @();
sender.tintColor = [UIColor redColor];
} anim.springBounciness = ;
anim.springSpeed = ; anim.completionBlock = ^(POPAnimation *anim, BOOL finished) {
NSLog(@"Animation has completed.");
};
[layer pop_addAnimation:anim forKey:@"size"];
[layer pop_addAnimation:rotation forKey:@"rotation"];
}
四:参考:
Facebook 开源动画库 pop的更多相关文章
- 使用 Facebook开源动画库 POP 实现真实衰减动画
1. POP动画基于底层刷新原理.是基于CADisplayLink,1秒钟运行60秒,接近于游戏开发引擎 @interface ViewController () @property (nonatom ...
- Facebook开源动画库 POP-POPBasicAnimation运用
动画在APP开发过程中还是经常出现,将花几天的时间对Facebook开源动画库 POP进行简单的学习:本文主要针对的是POPBasicAnimation运用:实例源代码已经上传至gitHub,地址:h ...
- Facebook开源动画库 POP-小实例
实例1:图片视图跟着手在屏幕上的点改变大小 - (void)viewDidLoad { [super viewDidLoad]; //添加手势 UIPanGestureRecognizer *gest ...
- Facebook开源动画库 POP-POPDecayAnimation运用
关于POPDecayAnimation的介绍先引用别人写的一些内容,基本上把它的一些注意点都说明了: Decay Animation 就是 POP 提供的另外一个非常特别的动画,他实现了一个衰减的效果 ...
- Facebook开源动画库 POP-POPSpringAnimation运用
POPSpringAnimation也许是大多数人使用POP的理由 其提供一个类似弹簧一般的动画效果:实例源代码已经上传至gitHub,地址:https://github.com/wujunyang/ ...
- rebound是facebook的开源动画库
网址:http://www.jcodecraeer.com/a/opensource/2015/0121/2338.html 介绍: rebound是facebook的开源动画库.可以认为这个动画库是 ...
- 第三方开源动画库EasyAnimation中一个小bug的修复
看过iOS动画之旅的都知道,其中在最后提到一个作者写的开源动画库EasyAnimation(以下简称EA). EA对CoreAnimation中的view和layer动画做了更高层次的包装和抽象,使得 ...
- [转] iOS 动画库 Pop 和 Canvas 各自的优势和劣势是什么?
iOS 动画库 Pop 和 Canvas 各自的优势和劣势是什么? http://www.zhihu.com/question/23654895/answer/25541037 拿 Canvas 来和 ...
- Lottie安卓开源动画库使用
碉堡的Lottie Airbnb最近开源了一个名叫Lottie的动画库,它能够同时支持iOS,Android与ReactNative的开发.此消息一出,还在苦于探索自定义控件各种炫酷特效的我,兴奋地就 ...
随机推荐
- Python— isinstance用法说明
在学习自动化测试的脚本中发现了这个函数,所以在网上查了一下资料进行如下整理: 通过帮助查看如下: 作用:来判断一个对象是否是一个已知的类型: 其第一个参数(object)为对象,第二个参数为类型名(i ...
- angular 自定义指令参数详解【转】【个人收藏用】
restrict:指令在dom中的声明形式 E(元素)A(属性)C(类名)M(注释) priority优先级:一个元素上存在两个指令,来决定那个指令被优先执行 terminal:true或false, ...
- django源码(2.0.2)粗解之命令行执行
前言 django的命令行在整个的django web开发中都会经常用到,而且是必须得用到.所以,能够了解下django的命令行实现其实是非常有帮助的. 如果大家比较关心django命令的详细说明和使 ...
- Oracle SP2-0640
安装Oracle database 11g express edition后,使用自带的SQL命令行,执行 select 1 from dual; 报出错误:SP2-0640 未连接 解决方法:使用 ...
- empireCMS 帝国cms功能总结
上1 系统 对应左菜单为 系统设置 系统参数设置 基本属性 站点名称,网站地址,关键字,简介,首页模式,php时间, 前台功能,操作时间,来源地址,验证码 用户属性 后台验证码开启,次数限制,时间限制 ...
- 从零开始搭建linux下laravel 5.5所需环境(三)
好的,我们已经安装好了nginx+mysql+php了,打开[ Laravel 5.5 文档 ] 快速入门 —— 安装配置篇 我们看到这里需要安装Composer,好的,我们现在就来安装Compose ...
- redhat 各种版本下载
http://www.linuxfly.org/post/659/ http://pan.baidu.com/share/home?uk=3742764079&view=share#categ ...
- 给.DLL文件加一个数字签名的方法
给.dll文件加一个数字签名的方法 效果如图所示: 做法: 下载数字签名工具包:http://files.cnblogs.com/babyt/SignTool.rar /Files/JavaC ...
- powerdesigner 设置字段显示comment注释
在Columns标签下,一排按钮中找到这个按钮:Customize Columns and Filter
- [翻译] SWTableViewCell
SWTableViewCell An easy-to-use UITableViewCell subclass that implements a swippable content view whi ...