如何实现 Google Play 图书中使用的页面卷曲类型? [英] How do I implement the type of page curl used in Google Play Books?

查看:35
本文介绍了如何实现 Google Play 图书中使用的页面卷曲类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找一种合适的方法来模拟 iOS 应用中使用的翻页/卷曲类型,但在 Android 应用中.我在 Android 上看到的最接近的东西是 Google Play Books 应用程序.他们是否使用了我没见过的 SDK 的某些部分?有没有机会得到类似的实现?

I've been searching for a proper way to emulate the kind of page flipping/curling used in the iOS apps but in an Android app. The closest thing I have seen on Android is the Google Play Books app. Are they using some part of the SDK that I haven't seen? Is there any chance of getting my hands on a similar implementation?

我见过的大多数示例都是使用某种基于 OpenGL 的 RenderView 构建的.这可能会奏效,但我必须确保屏幕不会徒劳无功,因为我不想使用太多电量.在处理不是 pow2 的纹理时,我也有点害怕使用 OpenGL.

Most of the examples I have seen are built using some sort of RenderView based on OpenGL. That would probably work, but I would have to make sure that the screen is not rendered in vain, since I don't want to use too much power. Also I'm a little afraid of using OpenGL when handling textures that are not pow2.

最好的问候,卡乐

推荐答案

你必须使用OpenGL才能在Android中制作这样的效果并且必须使用下面常见的正弦图方程:-

You have to use OpenGl for making such effect in Android and have to use the below common sinusoidal graph equation :-

y=Asin(2π/λ*x)

y=Asin(2π/λ*x)

在哪里,

A = 幅度(即我们想要的卷曲高度).

A = Amplitude (i.e. the elevation of curl we want).

λ = 波长(即我们想要的卷曲长度).

λ = Wavelength (i.e. the length of the curl we want).

x = X 轴变量,当您移动页面时会发生变化.

x = The X axis variable which will change as you move the page.

你必须在 SurfaceView 上绘制 3 个页面,即 'LeftPage' 、 'CenterPage' 和 'RightPage' , 'CenterPage' 始终可见并负责 'right curl' 动画,而 'LeftPage' 负责 'left curl'动画和RightPage"只是保持静止.检测手势使用默认的 GestureDetector 类.

You have to draw 3 pages on SurfaceView namely 'LeftPage' , 'CenterPage' and 'RightPage', 'CenterPage' is always visible and is responsible for 'right curl' animation while 'LeftPage' is responsible for 'left curl' animation and 'RightPage' just stay static. For detecting gestures use default GestureDetector class.

您可以从这里下载示例.

这篇关于如何实现 Google Play 图书中使用的页面卷曲类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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