O'Reilly logo

Building Android UIs with Custom Views by Raimon Ràfols Montané

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Timed frame animations

We have already used this kind of animation on the 3D example in our previous chapter. The main concept consists of assigning a new value to all the animatable properties before drawing a new frame based on the amount of time passed. We can be tempted with incrementing or computing a new value based on the number of frames drawn, but that is highly inadvisable, as the animation will be played at different speeds depending on the speed of the device, computation, or drawing complexity and other processes executing in the background.

To do it right, we have to involve something independent from the rendering speed, frames per second, or frames drawn, and a perfect solution is to use time-based animations.

Android provides ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required