cocos2dx 3.1.1官方demo阅读-ActionsProgressTest【进度条】
来源:互联网 发布:七夕表白源码 编辑:程序博客网 时间:2024/05/01 13:50
1,SpriteProgressToRadial(旋转进度条)
auto to1 = Sequence::createWithTwoActions(ProgressTo::create(2, 100), ProgressTo::create(0, 0)); auto left = ProgressTimer::create(Sprite::create(s_pathSister1));//设置进度条的类型 left->setType( ProgressTimer::Type::RADIAL ); addChild(left); left->setPosition(Vec2(100, s.height/2)); left->runAction( RepeatForever::create(to1));
2,SpriteProgressToHorizontal(水平进度条)
auto to1 = Sequence::createWithTwoActions(ProgressTo::create(2, 100), ProgressTo::create(0, 0)); auto to2 = Sequence::createWithTwoActions(ProgressTo::create(2, 100), ProgressTo::create(0, 0)); auto left = ProgressTimer::create(Sprite::create(s_pathSister1)); left->setType(ProgressTimer::Type::BAR); // Setup for a bar starting from the left since the midpoint is 0 for the x//设置midpoint的x为0,表示进度条从坐标开始,要从右开始,设置为1。 left->setMidpoint(Vec2(0,0)); // Setup for a horizontal bar since the bar change rate is 0 for y meaning no vertical change//设置change rate的y为0,表示y方向上不存在变化,而x设置为1,所以就是一个水平的进度条 left->setBarChangeRate(Vec2(1, 0)); addChild(left); left->setPosition(Vec2(100, s.height/2)); left->runAction( RepeatForever::create(to1));
3,SpriteProgressToVertical(垂直进度条)
auto to1 = Sequence::createWithTwoActions(ProgressTo::create(2, 100), ProgressTo::create(0, 0)); auto to2 = Sequence::createWithTwoActions(ProgressTo::create(2, 100), ProgressTo::create(0, 0)); auto left = ProgressTimer::create(Sprite::create(s_pathSister1)); left->setType(ProgressTimer::Type::BAR); // Setup for a bar starting from the bottom since the midpoint is 0 for the y//设置midPoint的y为0,所以起点从底部开始 left->setMidpoint(Vec2(0,0)); // Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change//同上,change rate x设置成0,表示在x方向上没有变化,也就是垂直进度条 left->setBarChangeRate(Vec2(0, 1)); addChild(left); left->setPosition(Vec2(100, s.height/2)); left->runAction( RepeatForever::create(to1));
4,SpriteProgressToRadialMidpointChanged(中心点改变的旋转进度条)
auto s = Director::getInstance()->getWinSize(); auto action = Sequence::createWithTwoActions(ProgressTo::create(2, 100), ProgressTo::create(0, 0)); /** * Our image on the left should be a radial progress indicator, clockwise */ auto left = ProgressTimer::create(Sprite::create(s_pathBlock)); left->setType(ProgressTimer::Type::RADIAL); addChild(left);//设置旋转的中心点 left->setMidpoint(Vec2(0.25f, 0.75f)); left->setPosition(Vec2(100, s.height/2)); left->runAction(RepeatForever::create(action->clone()));
5,SpriteProgressBarVarious(midPoint和changrate不同参数的情况)
auto to = Sequence::createWithTwoActions(ProgressTo::create(2, 100), ProgressTo::create(0, 0)); auto left = ProgressTimer::create(Sprite::create(s_pathSister1)); left->setType(ProgressTimer::Type::BAR); // Setup for a bar starting from the bottom since the midpoint is 0 for the y//设置起点是(0.5,0.5) left->setMidpoint(Vec2(0.5f, 0.5f)); // Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change//只在x方向上有改变 left->setBarChangeRate(Vec2(1, 0)); addChild(left); left->setPosition(Vec2(100, s.height/2)); left->runAction(RepeatForever::create(to->clone())); auto middle = ProgressTimer::create(Sprite::create(s_pathSister2)); middle->setType(ProgressTimer::Type::BAR); // Setup for a bar starting from the bottom since the midpoint is 0 for the y middle->setMidpoint(Vec2(0.5f, 0.5f)); // Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change//x,y上都有改变 middle->setBarChangeRate(Vec2(1,1)); addChild(middle); middle->setPosition(Vec2(s.width/2, s.height/2)); middle->runAction(RepeatForever::create(to->clone())); auto right = ProgressTimer::create(Sprite::create(s_pathSister2)); right->setType(ProgressTimer::Type::BAR); // Setup for a bar starting from the bottom since the midpoint is 0 for the y right->setMidpoint(Vec2(0.5f, 0.5f)); // Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change//只在y上有改变 right->setBarChangeRate(Vec2(0, 1)); addChild(right); right->setPosition(Vec2(s.width-100, s.height/2)); right->runAction(RepeatForever::create(to->clone()));
6,SpriteProgressBarTintAndFade(带tint和fade效果的进度条)
auto tint = Sequence::create(TintTo::create(1, 255, 0, 0), TintTo::create(1, 0, 255, 0), TintTo::create(1, 0, 0, 255), NULL); auto fade = Sequence::create(FadeTo::create(1.0f, 0), FadeTo::create(1.0f, 255), NULL); auto right = ProgressTimer::create(Sprite::create(s_pathSister2)); right->setType(ProgressTimer::Type::BAR); // Setup for a bar starting from the bottom since the midpoint is 0 for the y right->setMidpoint(Vec2(0.5f, 0.5f)); // Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change right->setBarChangeRate(Vec2(0, 1)); addChild(right); right->setPosition(Vec2(s.width-100, s.height/2)); right->runAction(RepeatForever::create(to->clone()));right->runAction(RepeatForever::create(tint->clone())); right->runAction(RepeatForever::create(fade->clone()));
7,SpriteProgressWithSpriteFrame
唯一不同的就是可以用精灵框帧。
SpriteFrameCache::getInstance()->addSpriteFramesWithFile("zwoptex/grossini.plist"); auto left = ProgressTimer::create(Sprite::createWithSpriteFrameName("grossini_dance_01.png"));
0 0
- cocos2dx 3.1.1官方demo阅读-ActionsProgressTest【进度条】
- cocos2dx 3.1.1官方demo阅读-AccelerometerTest【加速度传感器】
- cocos2dx 3.1.1官方demo阅读-ActionManagerTest【动作管理】
- cocos2dx 3.1.1官方demo阅读-ActionsTest【基础动作】
- cocos2dx 3.1.1官方demo阅读-在安卓平台运行cpp-tests 官方Demo
- Cocos2d-x 3.1.1 Lua示例 ActionsProgressTest(进度条)
- [Android官方Demo系列] Displayprogressnotify进度条通知
- mxgraph-官方demo(1)
- cocos2dx 3.1.1 ProgressTimer游戏进度条简明实例(语言C++)
- cocos2dx 官方示例学习(一), 了解demo结构
- cocos2dx进度条
- 云之讯官方测试Demo音频版源码阅读
- cocos2dx 3.1.1物理引擎做个晃绳子的小demo
- cocos2dx Demo
- cocos2dx 2.0中进度条
- cocos2dx进度条样式设置
- cocos2dx进度条笔记
- spark官方文档阅读笔记1
- springmvc参数的传递
- Java中static、final用法小结
- 一个令人蛋疼的NDK链接错误
- 华为离职副总裁徐家骏:年薪千万的工作感悟
- 个人对openAL的看法
- cocos2dx 3.1.1官方demo阅读-ActionsProgressTest【进度条】
- 【线段树】HDU 3308 LCIS
- Pasha and Hamsters
- 安装 Linux 应知的十件事
- 立体影片格式全面全解析
- lua基础
- 10年软件测试工作总结
- 表达式中缀转后缀
- Winform 快捷键设置