As part of the property animator system, we have the ValueAnimator class. We can use it to simply animate int, float, or color variables or properties. It's quite easy to use, for instance we can animate a float value from 0 to 360 during 1500 milliseconds using the following code:
ValueAnimator angleAnimator = ValueAnimator.ofFloat(0, 360.f); angleAnimator.setDuration(1500); angleAnimator.start();
This is alright, but if we want to get updates of the animation and react to them, we've got to set an AnimatorUpdateListener():
final ValueAnimator angleAnimator = ValueAnimator.ofFloat(0, 360.f); angleAnimator.setDuration(1500); angleAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator ...