cocos2d-x 2.X demo学习笔记 4 ----ActionsProgress 精灵慢慢展开

CCProgressTo *to1 = CCProgressTo::create(2, 100);//扩展到的时间,和展开全图的百分比,创建一个展开的动作  旋转式展开

CCProgressTimer *left=CCProgressTimer::create(CCSprite::create(image));//创建一个慢慢展开的角色

left->setReverseProgress(true);//反向展开


横向展开

    CCProgressTimer *left = CCProgressTimer::create(CCSprite::create(s_pPathSister1));
    left->setType(kCCProgressTimerTypeBar);


    //    Setup for a bar starting from the bottom since the midpoint is 0 for the y
    left->setMidpoint(ccp(0,0));
    //    Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
    left->setBarChangeRate(ccp(0, 1));
    addChild(left);
    left->setPosition(CCPointMake(100, s.height/2));
    left->runAction( CCRepeatForever::create(to1));
    
    CCProgressTimer *right = CCProgressTimer::create(CCSprite::create(s_pPathSister2));
    right->setType(kCCProgressTimerTypeBar);
    //    Setup for a bar starting from the bottom since the midpoint is 0 for the y
    right->setMidpoint(ccp(0, 1));
    //    Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
    right->setBarChangeRate(ccp(0, 1));
    addChild(right);
    right->setPosition(CCPointMake(s.width-100, s.height/2));
    right->runAction( CCRepeatForever::create(to2));


 竖向展开

CCProgressTimer *left = CCProgressTimer::create(CCSprite::create(s_pPathBlock));
    left->setType(kCCProgressTimerTypeRadial);
    addChild(left);
    left->setMidpoint(ccp(0.25f, 0.75f));
    left->setPosition(ccp(100, s.height/2));
    left->runAction(CCRepeatForever::create((CCActionInterval *)action->copy()->autorelease()));


你可能感兴趣的:(cocos2d-x 2.X demo学习笔记 4 ----ActionsProgress 精灵慢慢展开)