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

相关推荐
new_bie_B1 小时前
Android16 Input 事件分发链路
android
浩宇软件开发3 小时前
SwiftUI入门 10 分钟学会做一个 App 引导页
ios·swiftui·swift
TDengine (老段)4 小时前
TDengine RAFT共识协议 — 选举、日志复制、快照与仲裁
android·大数据·数据库·物联网·架构·时序数据库·tdengine
90后的晨仔5 小时前
SwiftUI 完全指南:从声明式 UI 到响应式架构的终点回顾
ios
90后的晨仔5 小时前
SwiftUI 多线程与并发编程深度总结
ios
90后的晨仔5 小时前
Combine 与系统框架集成:将响应式编程融入 Apple 生态
ios
90后的晨仔5 小时前
Combine 与 Swift Concurrency:响应式与并发的完美协奏
ios
90后的晨仔5 小时前
Combine 自定义 Subject:构建专属的响应式事件源
ios
90后的晨仔5 小时前
Combine 架构模式:构建响应式应用的蓝图
ios
90后的晨仔5 小时前
Combine 高级实践:多线程调度、调试与测试
ios