微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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);

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐