我的GameRenderer类中的补间不起作用。他们没有表现出错误,但他们只是被忽略了。
TweenManager tweenManager;
public class GameRenderer(GameWorld g){
...
tweenManager = new TweenManager();
initButton();
}
void initButton(){
.. initializing button ..
button.addListener(new ClickListener(){
@Override
public void clicked(InputEvent event, float x, float y){
Tween.registerAccessor(ShapeRenderer.class, new ShapeAccessor());
Tween.set(fader, ShapeAccessor.ALPHA).target(fader.getColor().a).start(tweenManager);
Tween.to(fader, ShapeAccessor.ALPHA, 2).target(1).start(tweenManager);
Tween.registerAccessor(Music.class, new MusicAccessor());
Tween.set(crowd, MusicAccessor.VOLUME).cast(Music.class).target(1).start(tweenManager);
Tween.to(crowd, MusicAccessor.VOLUME, 2).cast(Music.class).target(0).setCallback(new TweenCallback(){
@Override
public void onEvent(int arg0, BaseTween<?> arg1) {
((Game) Gdx.app.getApplicationListener()).setScreen(new GameScreen());
}
}).start(tManager);
}
});
}
当我单击按钮时,它被注册为已单击,但补间被忽略。
答案 0 :(得分:0)
确保在render()方法中更新补间管理器,如下所示:
tweenManager.update(Gdx.graphics.getDeltaTime());