我在网上冲浪寻找用于打开Android的页面和那里只是似乎并没有成为一个不错的效果。由于我在学习这似乎是一个很好的事情该平台能够做的就是这一点。
I was surfing the net looking for a nice effect for turning pages on Android and there just doesn't seem to be one. Since I'm learning the platform it seemed like a nice thing to be able to do is this.
我设法在这里找到一个页面:http://wdnuon.blogspot.com/2010/05/implementing-ibooks-page-curling-using.html
I managed to find a page here: 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的例子(上图)code,但我不知道我怎么会去在Android上实现这一点。难道任何的数学神在那里,请帮助我我怎么会去了解Android中Java的实现这一点。
that gives an example (above) code for iPhone but I have no idea how I would go about implementing this on android. Could any of the Math gods out there please help me out with how I would go about implementing this in Android Java.
是否可以使用原生的绘制的API,我将不得不使用OpenGL?我可以mimik的行为以某种方式?
Is it possible using the native draw APIs, would I have to use openGL? Could I mimik the behaviour somehow?
任何帮助将是AP preciated。谢谢你。
Any help would be appreciated. Thanks.
*******EDIT*************************
*******EDIT*************************
我发现在Android API演示位图目例如:http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/graphics/BitmapMesh.html
I found a Bitmap Mesh example in the Android API demos: http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/graphics/BitmapMesh.html
也许有人可以帮助我在一个公式来简单地折叠右上角向内diagnally在页面上创建以后可以申请阴影向GIE更深入的类似的效果?
Maybe someone could help me out on an equation to simply fold the top right corner inward diagnally across the page to create a similar effect that I can later apply shadows to to gie it more depth?
我刚刚创建了一个开源项目使用原生的帆布设有一个页面卷曲仿真2D:的 HTTP://$c$c.google.com/p/android-page-curl/ 我还在上添加适配器和这样的,以使其可作为一个独立的观点。
I just created a open source project which features a page curl simulation in 2D using the native canvas: http://code.google.com/p/android-page-curl/ I'm still working on it to add adapters and such to make it usable as a standalone view.
编辑:链接更新 编辑:丢失的文件已被推到回购