Android页面卷曲动画

发布于 2024-09-05 07:10:03 字数 266 浏览 15 评论 0原文

  1. 有没有简单的方法来做Curl翻页动画?卷曲动画是页面翻转的动画,包括上面的页面滚动和下面的页面阴影。
  2. 创建一次显示两页的“画廊”(就像一本书一样)的推荐方法是什么?

    是吗:

    1. 让适配器一次显示两个图像的线性布局? (它不会让我像书一样显示一页翻过另一页)
    2. 使用两页,以某种方式将其中一页靠近另一页,然后在需要制作动画时将接下来的两页移过去? 有什么更好的方法可以实现左页翻转右页显示?
  1. Is there a simple way to do the Curl page flipping animation? A Curl animation is animation of pages flipping, including the page above rolling and the shadows over the lower page.
  2. What is the recommended way to do a "gallery" that displays two pages at a time (just like a book)?

    Is it:

    1. Letting the adapter display a linear layout of two images at a time? (it won't let me show a page flipping over the other like a book)
    2. Using two pages, placing somehow one near the other, and then when it's time to animate -move the next two pages over?
      What is the better way that would enable displaying the left page flipping over the right page?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

不醒的梦 2024-09-12 07:10:03

我正在本机画布中实现 2D 卷页。检查我的答案:在android上实现页面卷曲?

编辑:代码项目我的实现: http://code.google.com/p/android-page-卷曲/
EDIT2:链接已更新

I'm implementing a 2D page curl in the native canvas. Check my answer in: Implement page curl on android?

EDIT: The code project of my implementation: http://code.google.com/p/android-page-curl/
EDIT2: Links updated

儭儭莪哋寶赑 2024-09-12 07:10:03

我正在使用这段代码。它真的非常适合任何人理解和使用。非常感谢 Harism

使用 OpenGL 在 android 中实现页面卷曲动画的 GitHub 链接

I am using this code. Its really really perfect for any one to understand and use. Thanks a lot to Harism

GitHub Link for Page Curl Animation in android With OpenGL

瞎闹 2024-09-12 07:10:03

我以前没有在android上工作过,但在我看来,进行页面翻转类型显示的最佳方法是将其绘制成三层。第一个是第一页的文本,第二个是下面的“页面”,第三个是下一页。如果您从后到前绘制它们,用户将看到的唯一内容将是第一页上的文本。

现在,一旦你有了这个,你就会想要根据你使用的任何控件来做某种卷曲/翻转动画。只需选择最适合您的动画方法即可,但在执行此操作时,将页面中不再存在的部分进行 alpha 处理。这将使您能够看到下面页面的文本(好吧,我撒谎了。您还需要该文本后面的背景)。

此时的问题是您仍然在同一空间上绘制文本两次,因此您需要将第一页的文本与其下方的动画混合。这样,超过 0 alpha 部分的文本将不可见。它不会随着动画而弯曲,因此这可能仍然是一个问题,但根据翻转的速度,这可能仍然没问题。动画完成后,只需设置第一页=第二页,动画重置为纯白色,第二页=新的第二页。

阴影效果可以简单地通过部分alpha化翻页动画后面的一些黑色来完成。绘制第二页(正如动画层已经在做的那样),瞧!

我相信你的两页问题可以使用非常相似的方法。祝你好运

I haven't worked on the android before, but it seems to me the best way to do a page flipping type of display would be to draw it in three layers. The first being the first page's text, the second being the "page" underneath, and the third being the next page. If you draw them from back to front, the only thing the user will see will be the text on the first page.

Now, Once you have that, you'll want to do some sort of curling/flipping animation based on whatever controls you are using. Simply choose whatever method works best for you for doing that animation, but while you are doing that, have the part of the page that isn't there anymore alpha'd out. This will allow you to see the text of the page underneath (Okay, I lied. You'll need a background behind that text too).

The problem at this point is you're still drawing the text twice over the same space, so you'll want to blend the first page's text with the animation under it. In this way, the text that is over the 0 alpha sections will be invisible. It won't bend with the animation, so that may still be an issue, but depending on the speed of the flip that might be fine still. When the animation is done, simply set the first page = the second, the animation reset to plain white, and the second page = the new second page.

The shadow effect can be done simply by partially alphaing out some black behind the page turn animation. Draw over second page (as the animation layer already is doing) and voila!

I believe your two page question could use a very similar method. Good luck

孤凫 2024-09-12 07:10:03

这是 3D 动画项目(基于 OpenGL 2.0) - http://anettosoftware.co.uk/npc.php

This is 3d animation project (based on OpenGL 2.0) - http://anettosoftware.co.uk/npc.php

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文