在cocos2d中相同提供了非常多表现图片和精灵的方式,上一篇其中提到的切换场景的方式之中的一个是顺或逆时针切入的方法,在图片上也能够使用,test里有一个样例介绍CCProgressTimer能够实现一些图片的特效效果,这种效果能够在加载的时候作为加载动画

步骤1.定义CCProgressTo。通过actionWithDuration函数,第一个參数是时间是一个CCTime对象。第二个參数是结果显示图片的百分比,如样例中一个100%,一个50%

步骤2 定义CCProgressTimer,通过progressWithFile,參数是图片路径

步骤3 调用setType设置类型。

kCCProgressTimerTypeRadialCW   顺时针生成

kCCProgressTimerTypeRadialCCW  逆时针生成

kCCProgressTimerTypeHorizontalBarLR 从左到右生成

kCCProgressTimerTypeHorizontalBarRL 从右到左生成

kCCProgressTimerTypeVerticalBarBT 从下到上生成

kCCProgressTimerTypeVerticalBarTB 从上到下生成

步骤4:设置位置,没什么好说的。直接setPosition

步骤5:開始,使用CCRepeatForever(反复进行),传入CCProgressTo对象

刚開始研究此引擎,如有错误之处。希望大家多多指正

下一篇写一下test类里面的其它场景

CCProgressTimer *progress1=CCProgressTimer::create(CCSprite::create("Icon.png"));

progress1->setPosition(ccp(100,100));

//设置进度条的样式

progress1->setType(kCCProgressTimerTypeRadial);

//设置进度值范围[0,100]

progress1->setPercentage(100);

//反进度计时

progress1->setReverseProgress(true);

this->addChild(progress1);

//第一个參数是时间。第二个參数是表示旋转100%

CCProgressTo *to1 = CCProgressTo::create(10, 100);

progress1->runAction(to1);

//------------------------------------------

CCProgressTimer *progress2=CCProgressTimer::create(CCSprite::create("Icon.png"));

progress2->setPosition(ccp(200,100));

//设置进度条的样式

progress2->setType(kCCProgressTimerTypeBar);

//设置计时器运动方向 第一个參数表示x比例第二个表示y比例

progress2->setMidpoint(ccp(0,1));

//设置计时器的宽高起始比例

progress2->setBarChangeRate(ccp(0, 1));

this->addChild(progress2);

//第一个參数是时间,第二个參数是表示旋转100%

CCProgressTo *to2 = CCProgressTo::create(10, 100);

progress2->runAction(to2);


CCProgressTo 和CCProgressTimer的更多相关文章

  1. CCProgressTo和CCProgressTimer

    在cocos2d中同样提供了很多表现图片和精灵的方式,上一篇当中提到的切换场景的方式之一是顺或逆时针切入的方法,在图片上也可以使用,test里有一个例子介绍CCProgressTimer可以实现一些图 ...

  2. [Cocos2d-x For WP8]Progress 进度条

    Cocos2d-x可以有多种进度条的展示方式,进度条的种类是根据进度条运动的方向来区分,包括顺时针,逆时针,从左到右,从右到左,从下到上和从上到下6种方式,这和WP8的进度条是由很大的区别的.那么Co ...

  3. cocos2d-x过程动作CCProgressTo示例学习笔记

    // // SpriteProgressToRadial // //------------------------------------------------------------------ ...

  4. Cocos2d-x CCProgressTimer

    CCProgressTimer,创建使用这个节点可以大致实现两个作用的效果: 其一:在游戏中几乎大部分的游戏启动界面都是游戏加载画面,那么用到的一般是进度条提示加载进度,其使用的就是CCProgres ...

  5. Cocos2d-x学习笔记(14)(更新函数scheduleUpdate、进度计时器CCProgressTo、滚动视图CCScrollView)

    一.scheduleUpdate 1.scheduleUpdate:此函数是CCNode的函数,每一个CCNode仅仅要调用scheduleUpdate更新函数,那么这个CCNode就会响应当前类的u ...

  6. cocos2d-x 之 CCProgressTimer

    --绕圆心转动的进度动画 local function SpriteProgressToRadial() local leftProgress = CCProgressTimer:create(CCS ...

  7. 3.18 CCProgressTo 进度计时器

    CCProgressTimer * pross = CCProgressTimer::create(CCSprite::create("Icon.png")); pross-> ...

  8. cocos2dx基础篇(21) 进度条CCProgressTimer

    [3.x] (1)去掉 "CC" (2)CCProgressTimerType 改为强枚举 ProgressTimer::Type:: // RADIAL //扇形进度计时器 BA ...

  9. CCProgressTimer用法

    bool HelloWorld::init(){ if ( !CCLayerColor::initWithColor(ccc4(255, 255, 2555, 255))){ return false ...

随机推荐

  1. hdu1876(dp)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1876 题意:问机器人到达终点的过程中最多有几次完全消耗完能量,消耗完这么多次能量的方式有几种. 分析: ...

  2. hdu3602(变形背包)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3602 题意是:N个国家,M个飞船,每个国家有人数num,如果上飞船就给联合国value钱,选出某些国家 ...

  3. RoboGuice注入框架简单应用

    1.设置Activity为RoboActivity; 2.设置界面@ContentView(int resId) 3.使用@InjectView(int resId)反射组件 4.使用@Inject ...

  4. WCF之添加自定义用户名密码认证

    1.创建WCF服务应用以及调用客户端(请自行google).  2.创建X509证书       cmd 进入  C:\Program Files\Microsoft SDKs\Windows\v6. ...

  5. Date和String类型的相互转换

    String转Date: SimpleDateFormat bartDateFormat = new SimpleDateFormat("MM-dd-yyyy"); String ...

  6. 最近调试HEVC中码率控制, 发现HM里面一个重大bug

    最近调试HEVC中码率控制, 发现里面一个重大bug! 码率控制中有这么一个函数: Int TEncRCGOP::xEstGOPTargetBits( TEncRCSeq* encRCSeq, Int ...

  7. linux下执行strlwr函数出错:ld returned 1 exit status

    执行strlwr函数时报错.源程序例如以下: #include<stdio.h> #include<string.h> void main() { char s[10]={&q ...

  8. Cocos2d-x中父节点scale对子节点的影响

    背景:在前几天,刚接触cocos2d-x,随便找了一张图,作为一个CCSprite,而且设置了scale属性,然后在这个sprite上创建了一个CCLabelTTF,并用sprite->addC ...

  9. 关于LIST.Select().ToList()慢的问题

    var sendlist = emailList.Select(email => new MailMessage { MailServer = SMTPServer, UserName = Se ...

  10. Linux下的下载工具介绍----aria2

    ariac 项目地址:http://aria2.sourceforge.net/ 下载地址:http://sourceforge.net/projects/aria2/files/stable/ari ...