cocos2d-x lua ProgressTimer

cocos2d-x lua ProgressTimer 下载进度条 使用

function test()
    local layer = cc.Layer:create()

    local to1 = cc.ProgressTo:create(2, 100)
    local to2 = cc.ProgressTo:create(2, 100)
    local path1 = "Jms_PetSystem/img/passMailIcon.png"
    -- RADIAL 圆形进度
    local test1 = cc.ProgressTimer:create(cc.Sprite:create(path1))
    test1:setType(cc.PROGRESS_TIMER_TYPE_RADIAL)
    test1:setPosition(cc.p(100, display.height / 2))
    test1:runAction(cc.RepeatForever:create(to1))
    layer:addChild(test1)

    --Horizontal 水平进度
    local test2 = cc.ProgressTimer:create(cc.Sprite:create(path1))
    test2:setType(cc.PROGRESS_TIMER_TYPE_BAR)
    -- right:setReverseDirection(true)
    test2:setMidpoint(cc.p(1, 0))
    test2:setBarChangeRate(cc.p(1, 0))
    test2:setPosition(cc.p(display.width - 100, display.height / 2))
    test2:runAction(cc.RepeatForever:create(to2))
    layer:addChild(test2)

    -- Vertical 从下到上 从上到下 修改test3:setMidpoint(cc.p(0, 0)) 点就行
    local test3 = cc.ProgressTimer:create(cc.Sprite:create(path1))
    test3:setType(cc.PROGRESS_TIMER_TYPE_BAR)
    -- Setup for a bar starting from the bottom since the midpoint is 0 for the y
    test3:setMidpoint(cc.p(0, 1))
    -- Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
    test3:setBarChangeRate(cc.p(0, 1))
    test3:setPosition(cc.p(display.width - 300, display.height / 2))
    test3:runAction(cc.RepeatForever:create(to2))
    layer:addChild(test3)

    self:addChild(layer)
end
 

相关推荐

  1. cocos2d-x lua ProgressTimer

    2024-01-07 09:36:04       56 阅读
  2. Visual Studio 和Clion配置Cocos2d-x环境

    2024-01-07 09:36:04       67 阅读
  3. 11、Cocos Creator 2D 渲染组件:Label 组件

    2024-01-07 09:36:04       33 阅读
  4. cocos2d-x中编译/调试curl库

    2024-01-07 09:36:04       26 阅读
  5. Cocos Creator UICanvas详解与2D游戏配置详解

    2024-01-07 09:36:04       35 阅读
  6. Cocos Creator 2D Mask与Layout 使用详解

    2024-01-07 09:36:04       39 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-01-07 09:36:04       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-01-07 09:36:04       100 阅读
  3. 在Django里面运行非项目文件

    2024-01-07 09:36:04       82 阅读
  4. Python语言-面向对象

    2024-01-07 09:36:04       91 阅读

热门阅读

  1. C++中的 greate/less 比较器模板的实现原理及作用

    2024-01-07 09:36:04       62 阅读
  2. 普通BUG

    普通BUG

    2024-01-07 09:36:04      53 阅读
  3. 记一个集群环境部署不完整导致的BUG

    2024-01-07 09:36:04       55 阅读
  4. LeetCode2807. Insert Greatest Common Divisors in Linked List

    2024-01-07 09:36:04       50 阅读
  5. HDU 2841:Visible Trees ← 容斥原理

    2024-01-07 09:36:04       62 阅读
  6. 【PHP】TP5使用orderRaw 方法设置排序规则

    2024-01-07 09:36:04       63 阅读
  7. 轮转数组【数组】

    2024-01-07 09:36:04       67 阅读
  8. js中浅拷贝和深拷贝的区别

    2024-01-07 09:36:04       59 阅读