JAR——nineoldandroids-2.4.0

  1. 简介

    为view设置动画效果;

  2. 使用方法

(1)设置中心点位置:

1
2
3
4
5
6
7
8
9
//设置中心点为view的原点,左上
ViewHelper.setPivotX(view,  0 );
ViewHelper.setPivotY(view,  0 );
//设置中心点为中间点
ViewHelper.setPivotX(view, target.getWidth() / 2f);
ViewHelper.setPivotY(view, target.getHeight() / 2f);
//设置中心为右下
ViewHelper.setPivotX(view, target.getWidth());
ViewHelper.setPivotY(view, target.getHeight());

(2)设置单个动画:

1
2
3
4
//String name,是要创建动画的名字,名字是固定的;
//具体的名字有:translationX、translationY、scaleX、scaleY、alpha、rotationX、rotationY、rotation;
//valuse是与动画对应的一些值(开始值,结束值,增量....)
ObjectAnimator.ofFloat(View, String animationName,  float ... values).setDuration(duration).start();

(3)设置动画集合:

1
2
3
4
5
6
7
8
9
//1.创建动画集
AnimatorSet set =  new  AnimatorSet();
//2.添加动画
set.playTogether(
     ObjectAnimator.ofFloat(view,  "scaleX" 2 1 .5f,  1 ).setDuration(mDuration),
     ObjectAnimator.ofFloat(view,  "scaleY" 2 1 .5f,  1 ).setDuration(mDuration), 
     ObjectAnimator.ofFloat(view,  "alpha" 0 1 ).setDuration(mDuration *  3  2 ));
//3.开启动画
set.start();
















本文转自wauoen51CTO博客,原文链接:http://blog.51cto.com/7183397/1604877  ,如需转载请自行联系原作者


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值