Cocos2d-x 3.4 进度条
旋转进度条
auto s = Director::getInstance()->getWinSize();
auto to1 = Sequence::createWithTwoActions(Progressto::create(2,100),Progressto::create(0,0));//旋转进度条
auto left = Progresstimer::create(Sprite::create("Images/grossini.png"));
left->setType(Progresstimer::Type::RADIAL);
left->setReverseProgress(true);//反转执行
addChild(left);
left->setposition(100,s.height/2);
left->runAction(RepeatForever::create(to1));
水平进度条
auto to2 =
auto left = Type::bar);//bar 水平进度条
left->setMIDpoint(Vec2(1,0));//从右到左 ,Vec2(0,0)为从左到右
left->setbarChangeRate(
addChild(left);
left->setposition(100,175); Font-family:新宋体; Font-size:9.5pt">RepeatForever::create(to2));
垂直进度条
auto t3 = Type::bar);
left->setMIDpoint(Vec2(0,1));//从上到下,Vec2(0,0)为从下到上
left->setbarChangeRate(
addChild(left);
left->setposition(100,175); Font-family:新宋体; Font-size:9.5pt">RepeatForever::create(t3));
bar类型进度条设置变化
auto t5 = Vec2(0.5f,0.5f));
left->setbarChangeRate(//从中心向四周扩散,Vec2(1,0)从中心向两边扩散,Vec2(0,1)从中心向山下扩散
addChild(left);
left->setposition(s.wIDth/2,175); Font-family:新宋体; Font-size:9.5pt">RepeatForever::create(t5));
可变换旋转中心的旋转进度条
auto t4 = Type::RADIAL);
left->setMIDpoint(Vec2(0.75f,0.25f));//设置旋转中心点
left->setbarChangeRate(RepeatForever::create(t4));
进度条搭配其他动作
auto t6 = Progressto::create(6,0));
auto hint = Sequence::create(TintTo::create(1,255,0),255),nullptr);
auto left =
left->runAction(RepeatForever::create(t6->clone()));
left->runAction(RepeatForever::create(hint->clone()));
使用缓存中图片加载进度条,通过加载pList文件
auto t7 =
SpriteFrameCache::getInstance()->addSpriteFramesWithfile("zwoptex/grossini.pList");
auto left = Sprite::createWithSpriteFramename("grossini_dance_01.png"));
left->setMIDpoint(
left->setbarChangeRate(
addChild(left);
left->setposition(300,300);
left->runAction(RepeatForever::create(t7->clone()));
总结以上是内存溢出为你收集整理的Cocos2d-x 3.4 进度条总结全部内容,希望文章能够帮你解决Cocos2d-x 3.4 进度条总结所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)