標籤:style blog http color 使用 os
先上quick代碼:
1 --[[建立扇形的進度載入條]] 2 3 --建立進度動作的Action(進度時間,最終比例) 4 local to1 = CCProgressTo:create(1, 100) 5 6 --傳入作為進度條用的精靈,建立ProgressTimer 7 local pTimer = CCProgressTimer:create(CCSprite:create(s_pPathSister1)) 8 pTimer:setType(kCCProgressTimerTypeRadial) --設定CCProgressTimer類型為Radial 9 --pTimer:setReverseProgress(true) --設定為逆時針旋轉載入(可選,預設順時針)10 pTimer:setPosition(CCPointMake(100, s.height / 2))11 pTimer:runAction(CCRepeatForever:create(to1))12 layer:addChild(pTimer)13 14 --[[建立矩形的進度載入條]]15 local to2 = CCProgressTo:create(2, 100)16 17 local pTimer1 = CCProgressTimer:create(CCSprite:create(s_pPathSister1))18 pTimer1:setType(kCCProgressTimerTypeBar) --設定為矩形進度條19 -- 設定進度條從左邊開始20 pTimer1:setMidpoint(CCPointMake(0, 0))21 -- 設定進度條Y方向的改變為0(Y方向不發生改變)22 pTimer1:setBarChangeRate(CCPointMake(1, 0))23 pTimer1:setPosition(CCPointMake(100, s.height / 2))24 pTimer1:runAction(CCRepeatForever:create(to2))25 layer:addChild(pTimer1)
:
&&
也可以使用CCScaleTo實現進度條Bar的載入效果。但是總體不是很好。
使用這個CCProgressTimer來實現,一切都簡單了。
更多用法,參考quick or Cocos2dx~