私は Android でページをめくるための素敵な効果を探してネットサーフィンをしていましたが、1 つもないようです。私はプラットフォームを学んでいるので、これができるのは素晴らしいことのように思えました.
ここでページを見つけることができました: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
たぶん、誰かが方程式で私を助けて、ページの右上隅を斜め内側に折りたたむだけで、後で影を適用してより深いものにすることができる同様の効果を作成できますか?