我有SplashScreen,我加载资源并显示图像
一切运作良好,但fadeIn Action虽然fadeOut有效但无法正常工作
这是我的代码:
public void show() {
stage = new Stage();
Texture splashTexture = new Texture(Gdx.files.internal("splash.png"));
splash = new Image(splashTexture);
splash.setPosition(Constants.WIDTH/2 - splash.getWidth()/2, Constants.HEIGHT/2 - splash.getHeight()/2);
stage.addActor(splash);
splash.getColor().a = 0;
SequenceAction sequenceAction = new SequenceAction(Actions.fadeIn(2.0f), Actions.delay(2.0f),
Actions.fadeOut(2.0f), Actions.run(new Runnable() {
@Override public void run() { gameMain.setScreen(new MenuScreen(gameMain, null, true)); } }));
splash.addAction(Actions.parallel(Actions.run(new Runnable() {
@Override public void run() { Assets.load();
} }), sequenceAction)); }
答案 0 :(得分:0)
尝试在fadeIn操作之前使用Actions.fadeOut(0f)
SequenceAction sequenceAction = new SequenceAction(Actions.fadeOut(0f),Actions.fadeIn(2.0f), ...);
或
而splash.getColor().a = 0;
使用splash.setColor(1,1,1,0);