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

相关推荐
帅得不敢出门2 小时前
Android Framework预装traceroute执行文件到system/bin下
android
xzkyd outpaper2 小时前
从面试角度回答Android中ContentProvider启动原理
android·面试·计算机八股
编程乐学2 小时前
基于Android 开发完成的购物商城App--前后端分离项目
android·android studio·springboot·前后端分离·大作业·购物商城
这个家伙很笨6 小时前
了解Android studio 初学者零基础推荐(4)
android·ide·android studio
alexhilton8 小时前
在Android应用中实战Repository模式
android·kotlin·android jetpack
黑码哥8 小时前
Copilot for Xcode (iOS的 AI辅助编程)
人工智能·copilot·ai编程·xcode·ai辅助编程
二流小码农12 小时前
鸿蒙开发:DevEcoTesting中的稳定性测试
android·ios·harmonyos
一起搞IT吧12 小时前
相机Camera日志实例分析之二:相机Camx【专业模式开启直方图拍照】单帧流程日志详解
android·图像处理·数码相机
xzkyd outpaper12 小时前
Android中ContentProvider细节
android·计算机八股