各种特效
Posted feizuzu
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了各种特效相关的知识,希望对你有一定的参考价值。
//雪花效果
schedule(schedule_selector(MainBoard::addSnowLight),0.2);
void MainBoard::addSnowLight(float dt){
UIImageView* pSnow = UIImageView::create();
pSnow->loadTexture("GameUI/snow.png");
pSnow->setPosition(ccp(rand() % 800,rand() % 480));
pSnow->setAnchorPoint(ccp(0.5,0.5));
pSnow->setOpacity(0);
pBackground->addChild(pSnow);
pSnow->runAction(CCSequence::create(CCFadeIn::create(0.5),CCFadeOut::create(0.5),NULL));
pSnow->runAction(CCSequence::create(CCMoveBy::create(1,ccp(-100,-100)),CCRemoveSelf::create(),NULL));
pSnow->runAction(CCRotateBy::create(1,360));
}
//按钮闪烁特效
schedule(schedule_selector(MainBoard::addStartLight),2);
void MainBoard::addStartLight(float dt){
for(int i = 0;i < 2;i++){
UIImageView* pLight = UIImageView::create();
pLight->loadTexture(i == 0 ? "GameUI/startLight2.png" : "GameUI/startLight.png");
pLight->setAnchorPoint(ccp(0.5,0.5));
pLight->setPosition(ccp(675,70));
addChild(pLight);
pLight->runAction(CCSequence::create(CCDelayTime::create(i * 0.05),
CCEaseOut::create(CCScaleTo::create(0.5,1.3),5),CCScaleTo::create(0.3,1.7),CCRemoveSelf::create(),NULL));
pLight->runAction(CCSequence::create(CCDelayTime::create(i * 0.05),
CCEaseOut::create(CCFadeOut::create(0.7),3),NULL));
}
}
以上是关于各种特效的主要内容,如果未能解决你的问题,请参考以下文章