垂直3dCarousel动画的android? [英] Vertical 3dCarousel animation in android?

查看:401
本文介绍了垂直3dCarousel动画的android?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以如何做到这一点的动画在Android中,这里下面是我试图修改它的链接,但有一个像下图没有输出。

How i can achieve this animation in android, here below is the link which i have tried to modify it but there is no output like below image.

http://horribile.blogspot.in/2011/11/ Android的3D-carousel.html

https://github.com/rameshkec85/Android-VerticalCarousel

我有修改如下功能如下垂直的动画。

i have modify below function for vertical animation as below.

private void Calculate3DPosition(CarouselItem child, int diameter,
            float angleOffset) {

    angleOffset = angleOffset * (float) (Math.PI / 180.0f);
    float x = 0.0f;
    float y = (float) (diameter / 2 * Math.sin(angleOffset)) + diameter / 2 - child.getWidth() / 2;
    float z = diameter / 2 * (1.0f - (float) Math.cos(angleOffset));                 

    child.setItemX(x);
    child.setItemZ(z);
    child.setItemY(y);
    }

,当我实现此结果,动画不能正常工作,并也图像没有在中心正确显示。

when i implement this as a result, animation is not work properly and also image is not display in center correctly.

做任何机构有正确实现这个动画,请给我。

does any body have implement this animation correctly, Please send me.

在此先感谢。

推荐答案

我已经实现了这个动画。

i have achieved this animation.

下面是链接,水平旋转木马动画这是最流行的。

Below is the link for horizontal carousel animation which is most popular.

Androd 3D旋转木马动画

现在,这里的变化,实现垂直传送带动画从上面的动画。

Now, here is the changes to achieve vertical carousel animation from above animation.

Carousel.java

  1. onFling :更改 velocityX velocityY

onScroll:更改trackMotionScroll(/ * -1 *的 /(INT)distanceX); trackMotionScroll(/ 的-1 * * /(INT)distanceY);

onScroll : Change trackMotionScroll(/* -1 * / (int) distanceX); To trackMotionScroll(/ -1 * */ (int) distanceY);

scrollIntoSlots:更改:如果(!角= 0.0)的如果(Math.abs(角度)> 4)

scrollIntoSlots : change "if (angle != 0.0f)" to "if (Math.abs(angle) > 4)"

Calculate3DPosition:

angleOffset = angleOffset *(浮动)(Math.PI / 180.0f);

angleOffset = angleOffset * (float) (Math.PI / 180.0f);

    float x = (screenWidth - child.getWidth())/2;       
    float y = (float) (diameter / 2 * Math.sin(angleOffset)) + diameter / 2 - child.getWidth() / 2;
    float z = diameter*2 * (1.0f - (float) Math.cos(angleOffset));

    child.setItemX(x);
    child.setItemZ(z);
    child.setItemY(y-(screenHeight - child.getHeight())/2);

享受旋转木马的动画。

这篇关于垂直3dCarousel动画的android?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆