O'Reilly logo

Android 3.0 Animations by Alex Shaw

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

Time for action—changing the rhythm with interpolators

We will put a few different interpolators into the mix now, and you can see for yourself which ones look most natural.

  1. Open up the file res/anim/block_drop.xml and look for the line which says:

    android:interpolator="@android:anim/linear_interpolator">

    Change it to read

    android:interpolator="@android:anim/bounce_interpolator">

    Now, whenever the block falls into a tower, it will bounce rather than just slide down.

  2. Build and run the HanoiActivity. What do you think? Does it look more natural now? Can you think of any improvements that we could make to the way it moves?
  3. Next, let's do the same to the block_move_right.xml animation. Open it up and we'll make some changes. This time, we are going ...

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