现在CCPageTurn3D似乎只能从右到左翻转,我想要做从左到右翻转,不知道要去如何修改?
求有做过的人指点下,谢谢!
同问~~~~~~~~~~~~~~~~~~~
改下CCActionPageTurn3D.cpp里的update()方法呗,不就是X轴方向的改变么,看下红色代码部分就是改动
void CCPageTurn3D::update(float time)
{
float tt = MAX(0, time - 0.25f);
float deltaAy = (tt * tt * 500);
float ay = -100 - deltaAy;
float deltaTheta = - (float) M_PI_2 * sqrtf( time) ;
float theta = /*0.01f */ + (float) M_PI_2 +deltaTheta;
float sinTheta = sinf(theta);
float cosTheta = cosf(theta);
for (int i = 0; i <= m_sGridSize.width; ++i)
{
for (int j = 0; j <= m_sGridSize.height; ++j)
{
// Get original vertex
ccVertex3F p = originalVertex(ccp(i ,j));
float R = sqrtf((p.x * p.x) + ((p.y - ay) * (p.y - ay)));
float r = R * sinTheta;
float alpha = asinf( p.x / R );
float beta = alpha / sinTheta;
float cosBeta = cosf( beta );
// If beta > PI then we've wrapped around the cone
// Reduce the radius to stop these points interfering with others
CCSize size = CCDirector::sharedDirector()->getWinSize();
if (beta <= M_PI)
{
// p.x = ( r * sinf(beta));
p.x = (size.width- r * sinf(beta));
}
else
{
// Force X = 0 to stop wrapped
// points
// p.x = 0;
p.x = size.width;
}
p.y = ( R + ay - ( r * (1 - cosBeta) * sinTheta));
// We scale z here to avoid the animation being
// too much bigger than the screen due to perspective transform
p.z = (r * ( 1 - cosBeta ) * cosTheta) / 7;// "100" didn't work for
// Stop z coord from dropping beneath underlying page in a transition
// issue #751
if( p.z < 0.5f )
{
p.z = 0.5f;
}
// Set new coords
setVertex(ccp(i, j), p);
}
}
}
补充下,加上cocos2d.h头文件