Learning Android Development

How to Animate and Plot Graphs Using Android Interpolator

Understand Interpolator and how to use it

Photo by Ellen Qin on Unsplash

If you’ve worked with any animation before, you probably heard about Android’s Interpolator. It’s a very important piece of functionality that helps define the rate of animation changes dynamically — e.g. slow at the start, fast later.

Android provides us with a list of readily available Interpolators. Using appropriate interpolators, animation can be made more realistic, as shown below:

Comparison of fan animations with different interpolators.

Using AccelerateDecelerateInterpolator on a fan makes it look more realistic (it starts and stops slowly) compare to LinearInterpolator (all at the same speed, which makes it feel like a sudden start and stop).

Understanding the Interpolator Visually

Understanding and anticipating the exact behavior of each Interpolator is sometimes not easy. They come with a potentially complex mathematic equation that we’ve long ago forgotten how to plot on a graph to understand its behavior precisely.

--

--