一: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的更多相关文章

  1. 使用 Facebook开源动画库 POP 实现真实衰减动画

    1. POP动画基于底层刷新原理.是基于CADisplayLink,1秒钟运行60秒,接近于游戏开发引擎 @interface ViewController () @property (nonatom ...

  2. Facebook开源动画库 POP-POPBasicAnimation运用

    动画在APP开发过程中还是经常出现,将花几天的时间对Facebook开源动画库 POP进行简单的学习:本文主要针对的是POPBasicAnimation运用:实例源代码已经上传至gitHub,地址:h ...

  3. Facebook开源动画库 POP-小实例

    实例1:图片视图跟着手在屏幕上的点改变大小 - (void)viewDidLoad { [super viewDidLoad]; //添加手势 UIPanGestureRecognizer *gest ...

  4. Facebook开源动画库 POP-POPDecayAnimation运用

    关于POPDecayAnimation的介绍先引用别人写的一些内容,基本上把它的一些注意点都说明了: Decay Animation 就是 POP 提供的另外一个非常特别的动画,他实现了一个衰减的效果 ...

  5. Facebook开源动画库 POP-POPSpringAnimation运用

    POPSpringAnimation也许是大多数人使用POP的理由 其提供一个类似弹簧一般的动画效果:实例源代码已经上传至gitHub,地址:https://github.com/wujunyang/ ...

  6. rebound是facebook的开源动画库

    网址:http://www.jcodecraeer.com/a/opensource/2015/0121/2338.html 介绍: rebound是facebook的开源动画库.可以认为这个动画库是 ...

  7. 第三方开源动画库EasyAnimation中一个小bug的修复

    看过iOS动画之旅的都知道,其中在最后提到一个作者写的开源动画库EasyAnimation(以下简称EA). EA对CoreAnimation中的view和layer动画做了更高层次的包装和抽象,使得 ...

  8. [转] iOS 动画库 Pop 和 Canvas 各自的优势和劣势是什么?

    iOS 动画库 Pop 和 Canvas 各自的优势和劣势是什么? http://www.zhihu.com/question/23654895/answer/25541037 拿 Canvas 来和 ...

  9. Lottie安卓开源动画库使用

    碉堡的Lottie Airbnb最近开源了一个名叫Lottie的动画库,它能够同时支持iOS,Android与ReactNative的开发.此消息一出,还在苦于探索自定义控件各种炫酷特效的我,兴奋地就 ...

随机推荐

  1. lua协程----ngx-lua线程学习笔记

    --[[ - @desc lua数据输出 - @param string 字符串 - return string --]] function dump(v) if not __dump then fu ...

  2. wikioi 3130 CYD刷题(背包)

    题目描述 Description 下午,CYD要刷题了,已知CYD有N题可刷,但他只有M分钟的时间,而且他的智慧值为Q,也就是说他只能做出难度小于等于Q的题目.已知每题可得积分Ai,需花费时间Bi,难 ...

  3. Windows下ftp服务器搭建及配置

    Win系统使用ser-u软件进行FTP服务器的搭建下载地址:https://www.serv-u.com/操作步骤如下:1. 点击执行程序进行按照SU-FTP-Server-Windows-v15.1 ...

  4. GoAhead2.5移植到ARM教程

    1.下载GoAhead2.5 下载地址:https://github.com/embedthis/goahead/releases?after=v3.1.2 2.编译 先解压到虚拟机的/opt目录下, ...

  5. antd 父组件获取子组件中form表单的值

    还是拿代码来讲吧,详情见注释 子组件 import React, { Component } from 'react'; import { Form, Input } from 'antd'; con ...

  6. spring---transaction(4)---源代码分析(事务的状态TransactionStatus)

    写在前面 TransactionStatus表示一个具体的事务状态(这里应用到了Java的一个多继承,接口允许多继承) TransactionStatus它继承了SavepointManager接口, ...

  7. 转:Windows中的命令行提示符里的Start命令执行路径包含空格时的问题

    转自:http://www.x2009.net/articles/windows-command-line-prompt-start-path-space.html 当使用Windows 中的命令行提 ...

  8. 在Windows Server 2008 R2中使用web方式修改域用户账户密码

    在Windows的domain环境下,加域的客户端修改账户密码是一件很easy的事情:即使没有加域的客户端如果组织中,使用Exchange邮件系统,借助Exchange的owa也可以轻松修改账户密码. ...

  9. FT项目开发技术点(三)

    1.eclipse中开发的web项目怎么放到tomcat中? 记得开始学习Java Web的时候,首先用的是Eclipse开发,但是有一个问题始终没有弄明白,做好的Web项目是如何发布到Tomcat服 ...

  10. Shell获取文件的文件名和扩展名的例子

    这篇文章主要介绍了Shell获取文件的文件名和扩展名的例子,简明版的代码实例,看了就懂,需要的朋友可以参考下 basename example.tar.gz .tar.gz # => examp ...