1.Android动画-属性动画-ObjectAnimator
https://www.jianshu.com/p/48d79eaf3470
2.属性动画(property animation) &重复执行
https://blog.csdn.net/yy471101598/article/details/50344917
3.ObjectAnimator平移并透明动画
https://blog.csdn.net/PremierAmour/article/details/79012228
demo
用属性动画实现一个按钮先平移出来后,在向上移动透明度注解变零
Button btn = findViewById(R.id.btn);
final Button show = findViewById(R.id.show);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ObjectAnimator translationX = ObjectAnimator.ofFloat(show, "translationX", 0, 100);
ObjectAnimator translationY = ObjectAnimator.ofFloat(show, "translationY", 0, -100);
ObjectAnimator alpha = ObjectAnimator.ofFloat(show, "alpha", 1.0f, 0f);
AnimatorSet set = new AnimatorSet();
set.play(translationY).with(alpha).after(translationX);
set.setDuration(5000);
set.start();
}
});