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

相关推荐
胖虎121 小时前
SwiftUI 页面作为一级页面数据被重置问题分析
ios·swiftui·swift·state·observedobject·stateobject·swiftui页面生命周期
nono牛1 天前
安卓/MTK平台日志关键词详解
android
TimeFine1 天前
Android AI解放生产力(四)实战:解放绘制UI的繁琐工作
android
sheji34161 天前
【开题答辩全过程】以 基于Android的社区车位共享管理系统的设计与实现为例,包含答辩的问题和答案
android
TimeFine1 天前
Android AI解放生产力(三):认识custom_prompts和skills
android
summerkissyou19871 天前
Android-Audio-为啥不移到packages/module
android·音视频
ChaITSimpleLove1 天前
基于 .NET Garnet 1.0.91 实现高性能分布式锁(使用 Lua 脚本)
分布式·.net·lua
catchadmin1 天前
PHP 值对象实战指南:避免原始类型偏执
android·开发语言·php
BoomHe1 天前
Android 键盘事件导致页面产生「 半透明蒙层」
android
用户69371750013841 天前
29.Kotlin 类型系统:智能转换:类型检查 (is) 与类型转换 (as)
android·后端·kotlin