效果图:

#import "ViewController.h"
#import <POP.h> @interface ViewController () @property (nonatomic, weak) UIView *testView; @end @implementation ViewController - (void)viewDidLoad
{
[super viewDidLoad]; self.view.backgroundColor = [UIColor blackColor]; // 初始化测试控件
UIView *testView = [[UIView alloc] initWithFrame:CGRectMake(, , , )];
testView.center = self.view.center;
testView.backgroundColor = [UIColor redColor];
self.testView = testView;
[self.view addSubview:testView];
} - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
// 初始化弹簧动画
POPSpringAnimation *springAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPLayerBounds];
springAnimation.springSpeed = ; // 设置动画速度(常用)
springAnimation.springBounciness = ; // 设置弹性大小(常用)
// springAnimation.dynamicsFriction = 10; // 设置阻止弹性的阻力(选用)
// springAnimation.dynamicsTension = 100; // 设置弹性的张力(可以理解为每次变大的程度, 选用)
if (self.testView.frame.size.width == ) {
springAnimation.toValue = [NSValue valueWithCGRect:CGRectMake(, , , )];
} else {
springAnimation.toValue = [NSValue valueWithCGRect:CGRectMake(, , , )];
} // 添加动画
[self.testView.layer pop_addAnimation:springAnimation forKey:nil];
} @end

github:https://github.com/RinpeChen/POPSpringAnimationDemo

用POP动画引擎实现弹簧动画(POPSpringAnimation)的更多相关文章

  1. 用POP动画引擎实现衰减动画(POPDecayAnimation)

    效果图: #import "ViewController.h" #import <POP.h> @interface ViewController () @end @i ...

  2. [译]理解 Windows UI 动画引擎

    本文译自 Nick Waggoner 的 "Understand what’s possible with the Windows UI Animation Engine",已获原 ...

  3. pop弹簧动画实现

    POP是一个在iOS与OS X上通用的极具扩展性的动画引擎.它在基本的静态动画的基础上增加的弹簧动画与衰减动画,使之能创造出更真实更具物理性的交互动画.POP的API可以快速的与现有的ObjC代码集成 ...

  4. 聊聊动画引擎 pop

    iOS可以通过CADisplayLink实现自定义动画引擎,pop就是基于此实现的,而且比原生Core Animation更强大好用.譬如当ViewController侧滑返回的时候,系统会将Core ...

  5. POP动画引擎中Layer与CALayer的一点区别

    POP动画引擎是facebook提供的一个开源框架, 可以实现很多的动画效果, 这里就不一一介绍啦, 有兴趣的童鞋请移步: https://github.com/facebook/pop 下面简单的讲 ...

  6. CADisplayLink+弹簧动画实现果冻效果

    项目中在Tabbar中间的按钮要从底部弹出视图并有果冻效果,在CocoaChina中找了一篇博客用 UIBezierPath 实现果冻效果,github,自己就按着上面的demo修改了一下( 之前也是 ...

  7. SpriteSheet精灵动画引擎

    SpriteSheet精灵动画引擎   本文介绍Flash中SpriteSheet精灵序列图与其它渲染方式的性能对比.SpriteSheet的原理及注意实现,最后实现了一个精灵序列图的渲染引擎.本文的 ...

  8. [范例] Firemonkey 弹簧动画

    弹簧动画效果: 不用写任何代码,只需设定下面动画属性: 参考动画曲线: http://monkeystyler.com/guide/Interpolation-and-AnimationType-Il ...

  9. Unity3d动画脚本 Animation Scripting(深入了解游戏引擎中的动画处理原理)

    也许这一篇文章的内容有点枯燥,但我要说的是如果你想深入的了解游戏引擎是如何处理动画片断或者素材并 让玩家操控的角色动起来栩栩如生,那么这真是一篇好文章(当然我仅仅是翻译了一下)   动画脚本 Anim ...

随机推荐

  1. 利用WebApi获取手机号码归属地

    前述: 在WebApi中,涉及到一个重要的类,HttpWebRequest. 学习link:httpwebrequest详解 示例演示: 代码示例: 1.前端代码: @{ ViewBag.Title ...

  2. android.os.NetworkOnMainThreadException异常处理办法

    网上搜索后知道是因为版本问题,在4.0之后在主线程里面执行Http请求都会报这个错,也许是怕Http请求时间太长造成程序假死的情况吧. 在发起Http请求的Activity里面的onCreate函数里 ...

  3. iOS Block 用法 (1)-once again

    Block简介: Block的实际行为和Function很像,最大的差别是在可以存取同一个Scope的变量值.Block实体形式如下: ^(传入参数列){行为主体}; Block实体开头是“^”,接着 ...

  4. Seek the Name, Seek the Fame

    poj2752:http://poj.org/problem?id=2752 题意:给你一个串,让你求前n个字符和后n个字符相同的n有多少,从小到大输出来. 题解:这一题要深刻理解KMP的next数组 ...

  5. hdu Co-prime

    题意:求出在一个区间[A,B]内与N互质的个数 . 思路: 先求出n的质因子,然后求出与N的质因子不互质的个数然后总个数减去就是.用位运算二进制表示那个因子用到过,实现容斥原理.在1到n之间是c倍数的 ...

  6. poj Cash Machine

    http://poj.org/problem?id=1276 #include<cstdio> #include<cstring> #include<cmath> ...

  7. j2ee爬坑行之二 servlet

    servlet生命周期 web容器加载servlet 类 web容器调用servlet的构造函数,初始化servlet. web容器调用servlet的init()方法.注意该方法在servlet的一 ...

  8. ext2,ext3,ext4文件系统管理软件包e2fsprogs

    e2fsprogs(也叫做e2fs programs)是一个Ext2(及Ext3/4)文件系统工具集(Ext2 Filesystems Utilities[2] ),它包含了诸如创建.修复.配置.调试 ...

  9. hdu5126stars

    http://acm.hdu.edu.cn/showproblem.php?pid=5126 首先,对于一个询问,用容斥原理可以拆成8个询问,于是询问变成:给定一个四元组$(i,x_i,y_i,z_i ...

  10. gcc编译命令

    g++ demo.cpp -o demo.exe