cocos2d钟摆运动//2S内顺时针旋转-60度\x05\x05CCRotateBy *rotaBy2 = CCRotateBy::create(2,-60);\x05\x05//2S内顺时针旋转60度\x05\x05CCRotateBy *rotaBy3 = CCRotateBy::create(2,60);\x05\x05//2S内实现先满后快的变速运动\x05\x05C
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/27 17:44:03
cocos2d钟摆运动//2S内顺时针旋转-60度\x05\x05CCRotateBy *rotaBy2 = CCRotateBy::create(2,-60);\x05\x05//2S内顺时针旋转60度\x05\x05CCRotateBy *rotaBy3 = CCRotateBy::create(2,60);\x05\x05//2S内实现先满后快的变速运动\x05\x05C
cocos2d钟摆运动
//2S内顺时针旋转-60度
\x05\x05CCRotateBy *rotaBy2 = CCRotateBy::create(2,-60);
\x05\x05//2S内顺时针旋转60度
\x05\x05CCRotateBy *rotaBy3 = CCRotateBy::create(2,60);
\x05\x05//2S内实现先满后快的变速运动
\x05\x05CCEaseInOut *ease2 = CCEaseInOut::create(rotaBy2,2);
\x05\x05//2S内实现先满后快的变速运动
\x05\x05CCEaseInOut *ease3 = CCEaseInOut::create(rotaBy3,2);
\x05\x05//合并2个变速运动
\x05\x05CCSequence *seq2 = CCSequence::createWithTwoActions(ease2,ease3);
\x05\x05//对象调用旋转
\x05\x05pDisc[m_Location-1]->runAction(CCRepeat::create(seq2,3));
为什么只在一边晃动,而且停的很突然,一点都不想钟摆一样慢慢的停下,
现在我设了4个运动,能不能把他们合并起来啊.我这样合并的时候直接终止了
cocos2d钟摆运动//2S内顺时针旋转-60度\x05\x05CCRotateBy *rotaBy2 = CCRotateBy::create(2,-60);\x05\x05//2S内顺时针旋转60度\x05\x05CCRotateBy *rotaBy3 = CCRotateBy::create(2,60);\x05\x05//2S内实现先满后快的变速运动\x05\x05C
1,首先rotaBy2使精灵的angle为-60,然后rotaBy3使精灵的angle为0,因为你用的是CCRotateBy,它只会根据当前的angle做出改变.所以只会在一边摆动.
2,你模拟钟摆的动作没有设置好,建议画出草图,描述好每个段落的动作,再写代码.
CCRotateBy *lRotate1 = CCRotateBy::create(1.0,60);
CCRotateBy *lRotate2 = CCRotateBy::create(1.0,-60);
CCRotateBy *lRotate3 = CCRotateBy::create(1.0,-60);
CCRotateBy *lRotate4 = CCRotateBy::create(1.0,60);
CCEaseSineOut *lEase1 = CCEaseSineOut::create(lRotate1);
CCEaseSineIn *lEase2 = CCEaseSineIn::create(lRotate2);
CCEaseSineOut *lEase3 = CCEaseSineOut::create(lRotate3);
CCEaseSineIn *lEase4 = CCEaseSineIn::create(lRotate4);
CCSequence *lSeq = CCSequence::create(lEase1,lEase2,lEase3,lEase4,NULL);
CCRepeatForever *lRepeat = CCRepeatForever::create(lSeq);