我在网上冲浪寻找在Android上翻页的好效果,但似乎并没有一个。因为我正在学习平台,所以能够做到这一点似乎是件好事。在android上实现页面卷曲?
我设法在这里找到一个页面:http://wdnuon.blogspot.com/2010/05/implementing-ibooks-page-curling-using.html
- (void)deform
{
Vertex2f vi; // Current input vertex
Vertex3f v1; // First stage of the deformation
Vertex3f *vo; // Pointer to the finished vertex
CGFloat R, r, beta;
for (ushort ii = 0; ii < numVertices_; ii++)
{
// Get the current input vertex.
vi = inputMesh_[ii];
// Radius of the circle circumscribed by vertex (vi.x, vi.y) around A on the x-y plane
R = sqrt(vi.x * vi.x + pow(vi.y - A, 2));
// Now get the radius of the cone cross section intersected by our vertex in 3D space.
r = R * sin(theta);
// Angle subtended by arc |ST| on the cone cross section.
beta = asin(vi.x/R)/sin(theta);
// *** MAGIC!!! ***
v1.x = r * sin(beta);
v1.y = R + A - r * (1 - cos(beta)) * sin(theta);
v1.z = r * (1 - cos(beta)) * cos(theta);
// Apply a basic rotation transform around the y axis to rotate the curled page.
// These two steps could be combined through simple substitution, but are left
// separate to keep the math simple for debugging and illustrative purposes.
vo = &outputMesh_[ii];
vo->x = (v1.x * cos(rho) - v1.z * sin(rho));
vo->y = v1.y;
vo->z = (v1.x * sin(rho) + v1.z * cos(rho));
}
}
给出一个例子(上图)为iPhone代码,但我不知道我怎么会去在Android上实现此。请问任何数学神灵都可以帮助我解决如何在Android Java中实现这一点。
是否有可能使用本机绘制API,我必须使用openGL吗?我能以某种方式模仿这种行为吗?
任何帮助,将不胜感激。谢谢。
****************编辑***************************** *****************
我发现在Android API演示位图网例如:http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/graphics/BitmapMesh.html
也许有人可以帮助我在一个公式来简单地折叠在页面右上角诊断内部创建一个类似的效果,我可以稍后应用阴影来更深入地展示它?
非常酷,继续,我认为你可以做得更好 – pengwang 2011-03-03 06:06:45
我将尽快提交一个新的版本,作为一个ListView,所以你将能够添加任何种类的视图! – Moss 2011-04-06 09:01:36
有趣但仍需要是独立的观点。 – Hamid 2011-04-12 08:07:13