简介

为view设置动画效果;

使用方法

(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)设置单个动画:

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

(3)设置动画集合:

//1.创建动画集AnimatorSetset=newAnimatorSet();//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();