标签首先完全显示而不是像我想要的那样淡入

Dai*_*air 2 iphone cocos2d-iphone

我试图CCLabelTTF淡出然后淡出.

这是我用来执行此操作的代码:

CCLabelTTF *intro = [CCLabelTTF labelWithString:@"Welcome" fontName:@"Times New Roman" fontSize:30];
[intro setPosition:ccp(240, 110)];
[intro runAction:[CCSequence actions:[CCFadeIn actionWithDuration:2.0f], [CCFadeOut actionWithDuration:2.0f], nil]];
[self addChild:intro];
Run Code Online (Sandbox Code Playgroud)

它有点工作,但是当我运行程序时,它会CCLabelTTF intro快速显示自己(不透明度为1.0f,有点像快速闪烁)然后它会消失并逐渐消失.

Dee*_*olu 5

为什么不将它的不透明度设置为零?

[intro setOpacity:0];
Run Code Online (Sandbox Code Playgroud)