温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

JAR——nineoldandroids-2.4.0

发布时间:2020-06-18 06:50:44 来源:网络 阅读:921 作者:wauoen 栏目:移动开发
  1. 简介

    为view设置动画效果;

  2. 使用方法

(1)设置中心点位置:

//设置中心点为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)设置单个动画:

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

(3)设置动画集合:

//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();


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI