我该如何让JavaFX在一个带有动画的方法完成后等待再执行下一个方法?我的代码如下:
public void spinWheel(){
RotateTransition rotation = new
rotation.setByAngle(-(720+(15*(i+(24-finalIndex)))));
rotation.play();
wheelResult=wheel.spinWheel(i);
spinButton.setOnAction(e->{
spinButton.setDisable(true);
wheelGui.spinWheel();
spinGame();
});
spinwheel()方法是一种动画效果,类似于一个转盘在旋转。该方法之后会打印一些代码,并在某些情况下重新激活按钮。然而,这是瞬间完成的。我希望在下一个方法运行之前动画能够完成,因为文本出现得太快或按钮再次开启可能会中断操作。
SequentialTransition
。 - fabian