码迷,mamicode.com
首页 > 其他好文 > 详细

quick-cocos2d-x 加载进度条的学习

时间:2014-07-22 00:13:35      阅读:167      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   使用   os   

先上quick代码:

 1     --[[创建扇形的进度加载条]]
 2 
 3     --创建进度动作的Action(进度时间,最终比例)
 4     local to1 = CCProgressTo:create(1, 100)
 5 
 6     --传入作为进度条用的精灵,创建ProgressTimer
 7     local pTimer = CCProgressTimer:create(CCSprite:create(s_pPathSister1))
 8     pTimer:setType(kCCProgressTimerTypeRadial) --设置CCProgressTimer类型为Radial
 9     --pTimer:setReverseProgress(true)  --设置为逆时针旋转加载(可选,默认顺时针)
10     pTimer:setPosition(CCPointMake(100, s.height / 2))
11     pTimer:runAction(CCRepeatForever:create(to1))
12     layer:addChild(pTimer)
13 
14     --[[创建矩形的进度加载条]]
15     local to2 = CCProgressTo:create(2, 100)
16 
17     local pTimer1 = CCProgressTimer:create(CCSprite:create(s_pPathSister1))
18     pTimer1:setType(kCCProgressTimerTypeBar)  --设置为矩形进度条
19     -- 设置进度条从左边开始
20     pTimer1:setMidpoint(CCPointMake(0, 0))
21     -- 设置进度条Y方向的改变为0(Y方向不发生改变)
22     pTimer1:setBarChangeRate(CCPointMake(1, 0))
23     pTimer1:setPosition(CCPointMake(100, s.height / 2))
24     pTimer1:runAction(CCRepeatForever:create(to2))
25     layer:addChild(pTimer1)

效果图:

bubuko.com,布布扣     &&    bubuko.com,布布扣

也可以使用CCScaleTo实现进度条Bar的加载效果。但是总体不是很好。

使用这个CCProgressTimer来实现,一切都简单了。

更多用法,参考quick or Cocos2dx~

quick-cocos2d-x 加载进度条的学习,布布扣,bubuko.com

quick-cocos2d-x 加载进度条的学习

标签:style   blog   http   color   使用   os   

原文地址:http://www.cnblogs.com/vokie/p/3858632.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!