在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?我可以以某种方式模仿行为吗?


任何帮助,将不胜感激。谢谢。


莫回无
浏览 533回答 3
3回答
打开App,查看更多内容
随时随地看视频慕课网APP