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—using shadows with our jigsaw

We want to give our jigsaw pieces a shadow when we pick them up, which will cast over the rest of the board until we put it down. We also want our shadow to raise and lower along with the animation.

Our jigsaw pieces are rectangular, which means that their shadows will also be rectangles. We will simply implement our shading technique by putting a black square behind our image, with a little bit of transparency and a slight offset between the image and the shadow.

Because we have already created a "depth" abstraction for making 3D moves, this should be easy to do in a nice smooth way.

  1. Open up RaisableImageView.java. This is where we'll be making all of our changes. First, we need to add a few more imports ...

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