欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

逐渐显示AtlasLabel数字结果,然后消失

程序员文章站 2022-05-28 11:54:29
...

逐渐显示AtlasLabel数字结果,然后消失;

效果如下:

逐渐显示AtlasLabel数字结果,然后消失

代码:

//逐渐显示AtlasLabel数字结果,然后消失
void LoginScene::fadeInRes(string num)
{
	Sprite* sp = static_cast<Sprite *>(this->csb->getChildByName("sp_res"));
	Vec2 pos = sp->getPosition();
	sp->setVisible(true);
	sp->setOpacity(0);

	auto res = static_cast<TextAtlas *>(sp->getChildByName("AtlasLabel_res"));
	res->setStringValue(num);

	MoveTo* mt = MoveTo::create(0.8f, Vec2(pos.x, pos.y + 150));
	FadeIn* fin = FadeIn::create(1.0f);
	FadeOut* out = FadeOut::create(0.01f);
	sp->runAction(Sequence::create(Spawn::create(fin, mt), DelayTime::create(1.0f), out, NULL));
	
}

 

相关标签: 移动并逐渐消失