逐渐显示AtlasLabel数字结果,然后消失
程序员文章站
2022-05-28 11:54:29
...
逐渐显示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));
}
上一篇: 动态加载js
下一篇: 切换fragment导致数据消失怎么办?