0

我想将 CCProgressTimer 平滑移动(从 100 到某个值)。

我编码 100% 到 80%,然后移动 0% 到 80%。

规格是否正确?

看看这段代码。

// Prepare CCProgressTimer
CCSprite *sp = CCSprite::create("white1x1.png", CCRectMake(0, 0, 940, 40)) ;
sp->setColor(ccc3(255,0,0)) ;    
CCProgressTimer *timer = CCProgressTimer::create(sp) ;
timer->setMidpoint(ccp(0,0)) ;
timer->setPercentage(100) ;
timer->setType(kCCProgressTimerTypeBar) ;
timer->setBarChangeRate(ccp(1.0f,0)) ;
timer->setPosition(ccp(480,320)) ;
this->addChild(timer) ;

// Prepare Action
CCDelayTime *delay = CCDelayTime::create(1.0f) ;
CCProgressTo *to1 = CCProgressTo::create(3.0f, 80) ; // 0 to 80 (Why?)
CCProgressTo *to2 = CCProgressTo::create(3.0f, 60) ; // 80 to 60
CCProgressTo *to3 = CCProgressTo::create(3.0f, 100) ; // 80 to 60
CCProgressTo *to4 = CCProgressTo::create(3.0f, 80) ; // 0 to 80 (Why?)
CCSequence *seq = CCSequence::create(to1,delay,to2,delay,to3,delay,to4,NULL) ;

// fire
timer->runAction(seq) ;
4

1 回答 1

0

CCProgressFromTo就是你要找的。

于 2013-05-22T17:42:42.763 回答