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

相关推荐
xiaolizi5674897 小时前
安卓远程安卓(通过frp与adb远程)完全免费
android·远程工作
阿杰100017 小时前
ADB(Android Debug Bridge)是 Android SDK 核心调试工具,通过电脑与 Android 设备(手机、平板、嵌入式设备等)建立通信,对设备进行控制、文件传输、命令等操作。
android·adb
梨落秋霜7 小时前
Python入门篇【文件处理】
android·java·python
我不是8神7 小时前
gin与gorm框架知识点总结
ios·iphone·gin
遥不可及zzz10 小时前
Android 接入UMP
android
Coder_Boy_11 小时前
基于SpringAI的在线考试系统设计总案-知识点管理模块详细设计
android·java·javascript
冬奇Lab12 小时前
【Kotlin系列03】控制流与函数:从if表达式到Lambda的进化之路
android·kotlin·编程语言
冬奇Lab12 小时前
稳定性性能系列之十二——Android渲染性能深度优化:SurfaceFlinger与GPU
android·性能优化·debug
冬奇Lab13 小时前
稳定性性能系列之十一——Android内存优化与OOM问题深度解决
android·性能优化