在这里就贴一个方法吧!!!!!!!!!!!!!哪里需要直接引用就行
private void initAnimator() {
//透明 从有到无在到有
ObjectAnimator alpha = ObjectAnimator.ofFloat(mTxtView, "alpha", 1f, 0f, 1f);
//X轴翻转
ObjectAnimator rotationX = ObjectAnimator.ofFloat(mTxtView, "rotationX", 0f, 360f);
//X轴缩放
ObjectAnimator scaleX = ObjectAnimator.ofFloat(mTxtView, "scaleX", 1f, 3f, 1f);
//Y轴缩放
ObjectAnimator scaleY = ObjectAnimator.ofFloat(mTxtView, "scaleY", 1f, 3f, 1f);
//创建AnimatorSet实例
AnimatorSet animatorSet = new AnimatorSet();
//动画运行时间
animatorSet.setDuration(1500);
//大家一起来
animatorSet.playSequentially(rotationX,scaleX,scaleY,alpha);
animatorSet.start();
//动画监听事件
animatorSet.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animator) {
}
@Override
public void onAnimationEnd(Animator animator) {
//动画结束时跳转
startActivity(new Intent(WelcomeActivity.this,MainActivity.class));
finish();
}
@Override
public void onAnimationCancel(Animator animator) {
}
@Override
public void onAnimationRepeat(Animator animator) {
}
});
}