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

相关推荐
BLUcoding13 分钟前
Android 常用控件及核心属性
android
遥不可及zzz22 分钟前
[特殊字符] Android AAB 一键安装工具配置指南
android·macos
私人珍藏库26 分钟前
【Android】一键硬核锁手机
android·智能手机·app·工具·软件
TTTao23331 小时前
自用Android项目框架备份
android
Bigger1 小时前
😭 在公司用 AI 写代码,你们上线的时候会不会有点慌?
ai编程·xcode·claude
SY.ZHOU1 小时前
移动端架构体系(四):View层的组织与调用方案
flutter·ios·架构·系统架构·安卓
沃尔威武1 小时前
性能调优实战:从火焰图定位到SQL优化的全流程
android·数据库·sql
Fᴏʀ ʏ꯭ᴏ꯭ᴜ꯭.2 小时前
基于MySQL一主一从环境添加多个新从库
android·mysql·adb
JJay.3 小时前
Android App Functions 深入理解
android
开发_李行4 小时前
简历对应知识点总结--专业技能5
android