给出两个连续的 javafx 动画之间的时间间隔

Give time gap between two consecutive javafx animations

我有一系列动画,一个接一个开始,如下面的代码所示。

animPath.playFromStart();
        animPath.setOnFinished((evt) -> {
            TranslateTransition tCut = showText(lblCutover);
            tCut.playFromStart();
            lblCutover.setVisible(true);
            tCut.setOnFinished((e11) -> {
                try {
                    Thread.sleep(10000);
                } catch (InterruptedException ex) {
                    Logger.getLogger(ARUOLandingPageController.class.getName()).log(Level.SEVERE, null, ex);
                }
                TranslateTransition tCutBack = hideText(lblCutover);
                tCutBack.playFromStart();
                tCutBack.setOnFinished((e12) -> {
                    lblCutover.setVisible(false);

                    anim11.playFromStart();
                    anim11.setOnFinished((evt11) -> {
                         (Some new animation)...
                    });
                });
            });
        });

我有两种类型的动画。一种是路径动画,另一种是平移动画。路径动画后没有时间间隔 required。 但是在一个翻译动画完成后,我想给下一个动画开始一个 10 秒的时间间隔。 我使用了 Thread.Sleep(10000) 但它停止了我的整个舞台。如果我点击任何地方,舞台将变得无响应。 有没有一种方法可以在不影响我的 ui?

中的任何其他部分的情况下,在这些动画之间设置时间间隔

您可以使用 Duration.seconds(10).

将多个转换放入 SequentialTransition, where one of them can be a PauseTransition