3D Carousel in Android

DreamsNeverDie picture DreamsNeverDie · Jan 2, 2014 · Viewed 9.2k times · Source

I am working on 3D Carousel for android.

I am using this code and the following is my current output.

enter image description here

I want to develop the following 3D shaped carousel.

enter image description here

I refered to the following questions which are already asked in SO.

  1. How to do 3d Carousel with modifications in image's dimensions and angle

  2. How to create list with carousel effect in android

  3. how to increase carousel image space?

  4. Coverflow Carousel effect same as iPhone/iPad in android

The following is near to my requirement:

  1. Using 3d Carousel project to create SPB Carousel style

From this I answer I put:

mCamera.rotateY(-((CarouselItem) child).getCurrentAngle());

inside getChildStaticTransformation() method of Carousel.java but I'm not getting a perfect result.

Please help me to solve it.

Answer

Andy Newman picture Andy Newman · May 12, 2014

You are using a function called Calculate3DPosition which calculates X, Y, Z positions from the angle and then those are used in a matrix.translate call.

What you need is actually much simpler - you just need to call matrix.rotate with the angle. It might look surprisingly easy when you've finished, but honestly, the only complexity in the 3D code you have copied is from attempting to keep everything facing the user instead of letting it rotate ...