Animating view and object properties

The property animation system provides a way for us to animate properties of any object, such as its position or opacity. It is also able to animate properties of custom types.

How to do it...

The ValueAnimator type lets us animate values of some type for the duration of an animation by specifying set values to animate through. Let's take a look at the following steps:

  1. We obtain a ValueAnimator type by calling one of its factory methods, such as OfInt, OfFloat, or OfObject. The instance is then used to tween a value from one value to another:
    ValueAnimator animator = ValueAnimator.OfInt(1, 1000);
    animator.SetDuration(5000);
    animator.SetInterpolator(new BounceInterpolator());
    animator.Start();
  2. We can also use the ...

Get Xamarin Mobile Development for Android Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.