2023-02-17 391
如何让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()方法是动画.它本质上是车轮旋转.该方法在打印一些代码后,在某些情况下重新激活该按钮.但是这是瞬时的.我希望动画在下一个方法运行之前完成,因为文本快速出现,或者按钮再次打开并可以中断动作.
您可以使用
RotateTransition rotateTransition = new RotateTransition();
rotateTransition.setOnFinished(e -> yourMethod())
rotateTransition.play();
以上所述是小编给大家介绍的JavaFX等待动画方法完成后再进入下一个方法,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对77isp云服务器技术网的支持!
原文链接:https://77isp.com/post/34140.html
=========================================
https://77isp.com/ 为 “云服务器技术网” 唯一官方服务平台,请勿相信其他任何渠道。
数据库技术 2022-03-28
网站技术 2022-11-26
网站技术 2023-01-07
网站技术 2022-11-17
Windows相关 2022-02-23
网站技术 2023-01-14
Windows相关 2022-02-16
Windows相关 2022-02-16
Linux相关 2022-02-27
数据库技术 2022-02-20
抠敌 2023年10月23日
嚼餐 2023年10月23日
男忌 2023年10月22日
瓮仆 2023年10月22日
簿偌 2023年10月22日
扫码二维码
获取最新动态