zoukankan      html  css  js  c++  java
  • quick-cocos2d-x 加载进度条的学习

    先上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~

  • 相关阅读:
    bzoj 2002 [Hnoi2010]Bounce 弹飞绵羊
    【无图慎入】Link Cut Tree 总结
    cogs1889 [SDOI2008]Cave 洞穴勘测 link-cut tree
    Codeforces Round #452 (Div. 2)
    【正经向】NOIP2017烤后总结
    cogs1772 [国家集训队2010]小Z的袜子
    noip2017普及题解
    noip2017 TG 游记
    noip2017 PJ AK记
    jzoj5341 捕老鼠
  • 原文地址:https://www.cnblogs.com/vokie/p/3858632.html
Copyright © 2011-2022 走看看