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—defining fixed points with Keyframes

We said that the Keyframe represents a fixed point in the animation, so let's use them to represent the fixed points in the Orrery animation.

  1. Open up Orrery.java. This is where we will make all of our changes.

    At the top of the file, add the following module:

    import android.animation.Keyframe;

    This is the standard Keyframe class.

  2. Locate the part in the code where we declared the two SolarSystemData objects. We will define two keyframes based on them, shown as follows:
    OrreryDrawable.SolarSystemData startSolarSystemData = new OrreryDrawable.SolarSystemData(); startSolarSystemData.rotationEarth = 0; startSolarSystemData.rotationMoon = 0; OrreryDrawable.SolarSystemData endSolarSystemData = new OrreryDrawable.SolarSystemData(); ...

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