quick-cocos2d-x 載入進度條的學習

來源:互聯網
上載者:User

標籤: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~

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.