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—animating between objects

There's something not quite right about our current OrreryDrawable interface. For instance, you could change the motion of the Earth without ever changing the Moon. That's ridiculous! The Moon would never stay still while the Earth orbited the Sun.

There is also a potential bug in the code such as: if you update the Earth's position after updating the Moon's position, the Moon will not update itself. We clearly need a better way of accessing our position setters.

Let's change our OrreryDrawable so that you can only set the Earth's rotation and the Moon's rotation at the same time. This is shown in the following steps:

  1. First, we will modify the OrreryDrawable to have the features that we want. Open up OrreryDrawable.java ...

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