Cocos2d 2.x 运动中的速度效果
前端之家收集整理的这篇文章主要介绍了
Cocos2d 2.x 运动中的速度效果,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
CCSize size = CCDirector::sharedDirector()->getWinSize(); CCSprite * sp = CCSprite::create("guang.png"); sp->setPosition(ccp(sp->getContentSize().width / 2,size.height/2)); addChild(sp); //1.指数缓冲 //1.1 CCEaseExponentialIn //CCEaseExponentialIn *exponentialIn = CCEaseExponentialIn::create(CCMoveTo::create(3.0f,ccp(size.width - sp->getContentSize().width / 2,size.height / 2))); //sp->runAction(exponentialIn); //1.2 CCEaseExponentialInOut //CCEaseExponentialInOut *exponentialInOut = CCEaseExponentialInOut::create(CCMoveTo::create(3.0f,size.height / 2))); //sp->runAction(exponentialInOut); //1.3 CCEaseExponentialOut //CCEaseExponentialOut *exponentialOut = CCEaseExponentialOut::create(CCMoveTo::create(3.0f,size.height / 2))); //sp->runAction(exponentialOut); //2.Sine缓冲 //2.1 CCEaseSineIn //CCEaseSineIn *sineIn = CCEaseSineIn::create(CCMoveTo::create(3.0f,size.height / 2))); //sp->runAction(sineIn); //2.2 CCEaseSineInOut //CCEaseSineInOut *sineInOut = CCEaseSineInOut::create(CCMoveTo::create(3.0f,size.height / 2))); //sp->runAction(sineInOut); //2.3 CCEaseSineOut //CCEaseSineOut *sineOut = CCEaseSineOut::create(CCMoveTo::create(3.0f,size.height / 2))); //sp->runAction(sineOut); //3.弹性缓冲 //static CCEaseElasticInOut* create(CCActionInterval *pAction,float fPeriod);//fPeriod是弧度的周期,默认是0.3 //static CCEaseElasticInOut* create(CCActionInterval *pAction); //3.1 CCEaseElastic //CCEaseElastic *elastic = CCEaseElastic::create(CCMoveTo::create(3.0f,size.height / 2))); //sp->runAction(elastic); //3.2 CCEaseElasticIn //CCEaseElasticIn *elasticIn = CCEaseElasticIn::create(CCMoveTo::create(3.0f,size.height / 2))); //sp->runAction(elasticIn); //3.3 CCEaseElasticInOut //CCEaseElasticInOut *elasticInOut = CCEaseElasticInOut::create(CCMoveTo::create(3.0f,size.height / 2))); //sp->runAction(elasticInOut); //3.4 CCEaseElasticOut //*** //CCEaseElasticOut *elasticOut = CCEaseElasticOut::create(CCMoveTo::create(5.0f,size.height / 2))); //sp->runAction(elasticOut); //4.跳跃缓冲 //4.1 CCEaseBounce //CCEaseBounce *bounce = CCEaseBounce::create(CCMoveTo::create(3.0f,size.height / 2))); //sp->runAction(bounce); //4.2 CCEaseBounceIn //CCEaseBounceIn *bounceIn = CCEaseBounceIn::create(CCMoveTo::create(3.0f,size.height / 2))); //sp->runAction(bounceIn); //4.3 CCEaseBounceInOut //CCEaseBounceInOut *bounceInOut = CCEaseBounceInOut::create(CCMoveTo::create(3.0f,size.height / 2))); //sp->runAction(bounceInOut); //4.4 CCEaseBounceOut //********** CCEaseBounceOut *bounceOut = CCEaseBounceOut::create(CCMoveTo::create(3.0f,size.height / 2))); sp->runAction(bounceOut); //5.回震缓冲 //5.1 CCEaseBackIn //CCEaseBackIn *backIn = CCEaseBackIn::create(CCMoveTo::create(3.0f,size.height / 2))); //sp->runAction(backIn); //5.2 CCEaseBackOut //CCEaseBackOut *backOut = CCEaseBackOut::create(CCMoveTo::create(3.0f,size.height / 2))); //sp->runAction(backOut); //5.3 CCEaseBackInOut //CCEaseBackInOut *backInOut = CCEaseBackInOut::create(CCMoveTo::create(3.0f,size.height / 2))); //sp->runAction(backInOut); 原文链接:https://www.f2er.com/cocos2dx/340985.html