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
CCProgressTo和CCProgressTimer的更多相关文章
- CCProgressTo 和CCProgressTimer
在cocos2d中相同提供了非常多表现图片和精灵的方式,上一篇其中提到的切换场景的方式之中的一个是顺或逆时针切入的方法,在图片上也能够使用,test里有一个样例介绍CCProgressTimer能够实 ...
- [Cocos2d-x For WP8]Progress 进度条
Cocos2d-x可以有多种进度条的展示方式,进度条的种类是根据进度条运动的方向来区分,包括顺时针,逆时针,从左到右,从右到左,从下到上和从上到下6种方式,这和WP8的进度条是由很大的区别的.那么Co ...
- cocos2d-x过程动作CCProgressTo示例学习笔记
// // SpriteProgressToRadial // //------------------------------------------------------------------ ...
- Cocos2d-x CCProgressTimer
CCProgressTimer,创建使用这个节点可以大致实现两个作用的效果: 其一:在游戏中几乎大部分的游戏启动界面都是游戏加载画面,那么用到的一般是进度条提示加载进度,其使用的就是CCProgres ...
- Cocos2d-x学习笔记(14)(更新函数scheduleUpdate、进度计时器CCProgressTo、滚动视图CCScrollView)
一.scheduleUpdate 1.scheduleUpdate:此函数是CCNode的函数,每一个CCNode仅仅要调用scheduleUpdate更新函数,那么这个CCNode就会响应当前类的u ...
- cocos2d-x 之 CCProgressTimer
--绕圆心转动的进度动画 local function SpriteProgressToRadial() local leftProgress = CCProgressTimer:create(CCS ...
- 3.18 CCProgressTo 进度计时器
CCProgressTimer * pross = CCProgressTimer::create(CCSprite::create("Icon.png")); pross-> ...
- cocos2dx基础篇(21) 进度条CCProgressTimer
[3.x] (1)去掉 "CC" (2)CCProgressTimerType 改为强枚举 ProgressTimer::Type:: // RADIAL //扇形进度计时器 BA ...
- CCProgressTimer用法
bool HelloWorld::init(){ if ( !CCLayerColor::initWithColor(ccc4(255, 255, 2555, 255))){ return false ...
随机推荐
- uni-app 如何引入全局方法或变量?
利用Vue.prototype挂载到Vue实例上即可
- from会存在潜在的陷阱
# -*- coding: utf-8 -*- #python 27 #xiaodeng #from会存在潜在的陷阱 #from时,可能会遇到相同变量名,变量会被悄悄覆盖掉, #但是import语句不 ...
- 商家 APP 如何接入新版支付宝支付,老版本商家如何升级
代码地址如下:http://www.demodashi.com/demo/14006.html 前言 支付宝移动支付2.0版本对比1.0版本做了较大更新,新申请的商家都需要采用最新2.0版本 SDK ...
- 兼顾pc和移动端的textarea字数监控的实现方法
概述 pc端移动端中文本框监控字数的功能的一种较为简单的实现,考虑到安卓和IOS输入法输入过程中是否触发keyup的差异.利用监听compositionstart判断是否开启了输入法.从而实现体验较为 ...
- linux 文件操作库函数
fopen :打开文件 fread :读文件 fwrite : 写文件 fgetc : 读字符 fputc : 写字符 fscanf : 格式化读 fprintf : 格式化写 fseek : 文件偏 ...
- 单节点k8s的一个小例子 webapp+mysql
安装kubernetes 准备一台centos7 1) 关闭firewalld 和 selinux systemctl stop firewalld systemctl disable firewal ...
- (原)Ubuntu16中安装nvidia的显卡驱动
转载请注明出处: http://www.cnblogs.com/darkknightzh/p/5638185.html part1 直接在“软件和更新-附加驱动”里面设置 安装完ubuntu16后,显 ...
- map reduce相关程序
Test_1.java /** * Hadoop网络课程模板程序 * 编写者:James */ import java.io.IOException; import java.text.DateFor ...
- bootstrap Validators
地址:http://reactiveraven.github.io/jqBootstrapValidation/
- Eclipse 选中变量高亮显示设置