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—spinning jigsaws

When the user first loads the jigsaw puzzle, we want the jigsaw puzzle to spin around in 3D. No real reason for this; it's just kinda cool.

We are going to use a Camera object, which is an object-oriented device for saying, "we want to look in this direction". In our case, the Camera will effectively move around the view we're animating, but this will appear to the user as if the view is spinning. I'll elaborate on Cameras later. The steps are as follows:

  1. First, let us import the Rotate3dAnimation.java file into our project. You can get it from the following location:
    ${ANDROID_SDK_LOCATION}/samples/android-11/api/demos/src/com/example/android/apis/animation/Rotate3dAnimation.java
    

    Copy this file into our jigsaw ...

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