且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何翻转像三维动画图像的android?

更新时间:2023-11-10 10:33:40

您可以通过在拉哈夫乔普拉的构建3D翻转库的 HTTPS://$c$c.google.com/p/android-3d-flip-view-transition

You can add realistic 3D flip transition by building on Raghav Chopra's the 3D flip library https://code.google.com/p/android-3d-flip-view-transition.

使用的,所有你需要做的是不是调用 flipper.showNext(); 呼叫 AnimationFactory.flipTransition(脚蹼,FlipDirection.LEFT_RIGHT ); 和你做。三维动画是pretty的凉爽。

With that, all you have to do is instead of calling flipper.showNext(); call AnimationFactory.flipTransition(flipper, FlipDirection.LEFT_RIGHT); and you are done. The 3D animation is pretty cool.

很多其他教程和示例codeS(包括你所使用的),不产生可信的3D翻转。在y轴上简单的旋转是不够所以看看上面的临客(或视频的http:// youtu。是/ 52mXHqX9f3Y )。

A lot of the other tutorials and sample codes (including the one you are using) don't produce believable 3D flips. A simple rotation on the y-axis isn't sufficient so take a look the above linke (or this video http://youtu.be/52mXHqX9f3Y).

如果你想拥有它自动转换,只需添加一个处理程序这样的:

If you want to have it automatically transition, simply add a Handler like:

Handler handler = new Handler();
...
handler.postDelayed(new Runnable() {
    AnimationFactory.flipTransition(flipper, FlipDirection.LEFT_RIGHT);
}, 500);

上面将保持在图像翻转,无限期(循环回第一图像底)。要停止自动转换,您可以添加您在启动翻转前检查,或保存的Runnable 您使用的是和呼叫 handler.removeCallbacks一个布尔标志(可运行)

The above will keep flipping through the images, indefinitely (cycling back to the first image at the end). To stop the auto transition, you add a boolean flag that you check before starting the flip, or save the Runnable you are using and call handler.removeCallbacks(runnable).