码迷,mamicode.com
首页 > 其他好文 > 详细

各种特效

时间:2017-01-09 13:34:10      阅读:289      评论:0      收藏:0      [点我收藏+]

标签:http   action   game   闪烁   oar   笔记   ota   board   addchild   

//雪花效果
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));
    }
}




各种特效

标签:http   action   game   闪烁   oar   笔记   ota   board   addchild   

原文地址:http://www.cnblogs.com/feizuzu/p/fbbbc07585560631f838993f03759bab.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!