0
我想旋轉一個按鈕。所以我寫了下面的代碼:按鈕不會旋轉libGDX
public void show() {
skin2 = new Skin (Gdx.files.internal("SettingsButton.json"));
button2 = new Button(skin2);
button2.setPosition(25,1440);
button2.setSize(120,120);
button2.setOrigin(button2.getWidth()/2, button2.getHeight()/2);
button2.addAction(Actions.repeat(RepeatAction.FOREVER,
Actions.sequence(
Actions.rotateBy(360, 1),
Actions.rotateTo(0))));
button2.addListener(new ClickListener(){
@Override
public void clicked(InputEvent event, float x, float y) {
game.setScreen(new SettingsScreen(game));
super.clicked(event, x, y);
}
});
stage.addActor(button2);
}
不幸的是,按鈕doesn't旋轉,但我不知道爲什麼。 我該如何改進我的代碼?
謝謝您啓用變換!有沒有設置旋轉速度的可能性? – user8340536
你是什麼意思的旋轉速度? – Aryan
我想設置按鈕在某段時間內的旋轉次數,例如一分鐘內的一次革命比一分鐘內的五次革命更慢。所以我想設置它。 – user8340536