zoukankan      html  css  js  c++  java
  • CCProgressTo和CCProgressTimer

    在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);

        //设置计时器运动方向

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

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

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

       

        this->addChild(progress2);

       

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

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

        progress2->runAction(to2); 

    转自:http://www.2cto.com/kf/201305/212168.html

  • 相关阅读:
    对pg_latch.c 的来源探索
    对PostgreSQL的执行计划的初步学习
    21个css和Ajax表格
    23种设计模式有趣诠释
    Spket IDE, Ext开发人员的紫色匕首~
    Sql Server 2008 Reporting Services系列(一)
    C#积累(二)——ASP.NET的Session会加锁
    在TSQL语句中访问远程数据库(openrowset/opendatasource/openquery)
    ASP.NET视图的保存与加载解析(一)——视图的保存
    C#积累(一)——扩展方法就近原则和匿名类型的成员探讨
  • 原文地址:https://www.cnblogs.com/wodehao0808/p/3600058.html
Copyright © 2011-2022 走看看