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~

  • 相关阅读:
    uvm_pkg——老板,打包带走
    uvm.sv——UVM之道
    uvm_comps.svh
    uvm_subscriber——告诉她我们来过
    uvm_monitor——借我一双慧眼
    编程面试过程中常见的10大算法(转)
    MySQL 分区表
    Nginx + Tomcat 动静分离实现负载均衡(转)
    浅析JVM内存结构和6大区域(转)
    Linux Shell编程变量赋值和引用
  • 原文地址:https://www.cnblogs.com/vokie/p/3858632.html
Copyright © 2011-2022 走看看