View の背景色をアニメーションしながら変更したい場合があって調べてみたら Property Animation | Android Developers というのがあった。
そしてモロそのままの質問が Stack Overflow にあった。
Animate change of view background color in Android - Stack Overflow
背景色が黒から透明になって消えていくアニメーションをするサンプル。
さり気なく API Level 11 から。2.x 系をサポートするなら NineOldAndroids を使おう。
final Integer black = getResources().getColor(R.color.black);
final Integer transparent = getResources().getColor(R.color.transparent);
ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), black, transparent);
colorAnimation.addUpdateListener(new AnimatorUpdateListener(){
@Override
public void onAnimationUpdate(ValueAnimator animator){
mView.setBackgroundColor((Integer)animator.getAnimatedValue());
}
});
colorAnimation.setDuration(1000);
colorAnimation.setInterpolator(new LinearInterpolator());
colorAnimation.start();指定するアニメーション補完クラスは以下がわかりやすい。
[Android] アニメーション補間クラスをグラフ化してみました - adakoda
式さえわかれば移植できそうだなー。これ↓っぽい?
Equations.as - tweener - A class for creating tweens in actionscript 2 and 3 - because there's infinity between 0 and 1. - Google Project Hosting
あとはこの手のアニメーション系の Web 版があったからそこから持ってきて実装というのも良さそう。