网址:http://www.jcodecraeer.com/a/opensource/2015/0121/2338.html

介绍:

rebound是facebook的开源动画库。可以认为这个动画库是独立于android Framework之外的一种动画实现。

运行效果:

使用说明:

Rebound官方主页

1.首先添加Rebound库依赖

Rebound提供了三种方式引入,当然在Android Studio下还是推荐使用Gradle方式。

添加Gradle依赖(推荐)

dependencies {
compile 'com.facebook.rebound:rebound:0.3.6'
}

下载Rebound Jar文件,导入工程,添加Maven依赖

<dependency>
<groupId>com.facebook.rebound</groupId>
<artifactId>rebound</artifactId>
<version>0.3.</version>
</dependency>

2.首先创建一个SpringSystem对象

SpringSystem mSpringSystem = SpringSystem.create();

3.添加一个“弹簧”到系统

Spring mSpring = mSpringSystem.createSpring();

4.添加监听器

mSpring.addListener(this);
//实现SpringListener接口,需要实现下面方法
@Override
public void onSpringUpdate(Spring spring) {
}
@Override
public void onSpringAtRest(Spring spring) {
}
@Override
public void onSpringActivate(Spring spring) {
}
@Override
public void onSpringEndStateChange(Spring spring) {
}

5.设置动画结束值

mSpring.setEndValue(1f);

6.在弹簧更新数据是对图片进行对应伸缩

public void onSpringUpdate(Spring spring) {
float value = (float) spring.getCurrentValue();
float scale = 1f - (value * 0.5f);
mImageToAnimate.setScaleX(scale);
mImageToAnimate.setScaleY(scale);
}

通过上面几个步骤可以很方便的实现弹簧阻尼效果的图片伸缩。

参考 :http://qichaochen.github.io/2014/11/21/107-Facebook-Rebound-Demo/

rebound是facebook的开源动画库的更多相关文章

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

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

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

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

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

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

  4. Facebook 开源动画库 pop

    官网:https://github.com/facebook/pop Demo: https://github.com/callmeed/pop-playground 一:pop的基本构成: POPP ...

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

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

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

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

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

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

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

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

  9. Facebook的Pop动画库相关资料

    https://github.com/facebook/pop http://www.cocoachina.com/industry/20140507/8339.html http://www.ui. ...

随机推荐

  1. 通过PHP current()函数获取未知字符键名数组第一个元素的值

    在开发中经常遇到这样问题,获取数组第一个元素的值,如果是数字索引那还好,直接$array[0],如果键名是字符串,你又未知这个字符串呢?用current()函数就可以做到. 当然,你可以用array_ ...

  2. Delphi制作QQ自动登录器源码

    Delphi制作QQ自动登录器源码  http://www.cnblogs.com/sunsoft/archive/2011/02/25/1964967.html 以TM2009为例,检查了一下,未登 ...

  3. Ubifs Support

    参考:http://processors.wiki.ti.com/index.php/UBIFS_Support#Creating_UBIFS_file_system UBIFS UBIFS may ...

  4. 利用jquery.form.js实现将form提交转为ajax方式提交的方法(带上传的表单提交)

    提供一种方法就是利用jquery.form.js. (1)这个框架集合form提交.验证.上传的功能. 核心方法 -- ajaxForm() 和 ajaxSubmit() $('#myForm').a ...

  5. C#中 protected internal 和 internal 的区别

    http://kudick.blog.163.com/blog/static/1666066320091055414453/ DoDo: protected: 爷爷有一张银行卡,爸爸可以用,儿子也可以 ...

  6. Flume推送数据到SparkStreaming案例实战和内幕源码解密

    本期内容: 1. Flume on HDFS案例回顾 2. Flume推送数据到Spark Streaming实战 3. 原理绘图剖析 1. Flume on HDFS案例回顾 上节课要求大家自己安装 ...

  7. zabbix agent被动模式配置

    zabbix agent检测分为主动(agent active)和被动(agent)两种形式,主动与被动的说法均是相对于agent来讨论的.简单说明一下主动与被动的区别如下: 主动:agent请求se ...

  8. Binder与interface

    在Interface中,asBinder函数涌来将服务类接口类型转换为IBinder类型: 相反的,asInterface函数用来将Ibinder类型转换为服务接口类型

  9. java学习笔记——可用链表

    NO 链表方法名称 描述 1 public void add(数据类型 对象) 向链表中增加数据 2 public int size() 查看链表中数据个数 3 public boolean isEm ...

  10. Efficiently traversing InnoDB B+Trees with the page directory--slot

    Efficientlytraversing InnoDB B+Trees with the page directory 1.the purpose of the page directory As ...