How to wait for a transition to end in javafx 2.1?

后端 未结 3 1665
心在旅途
心在旅途 2020-12-16 05:07

My scene consists only of an ImageView, displaying an image. I would like to fade the image to black (assigned color of the scene), then after some time, fade from black to

3条回答
  •  遥遥无期
    2020-12-16 05:10

    Ok if your ft2 is the reflective animation of ft1 then do

    ft1.setAutoReverse(true);
    ft1.setCycleCount(1);
    // Or
    // ft1.setCycleCount(Timeline.INDEFINITE);
    // to loop infinitely (blinking effect) until stop()
    

    and you don't ft2. If you still need ft2 to play after ft1 then

    ft1.setOnFinished(new EventHandler() {
    
        @Override
        public void handle(ActionEvent event) {
            ft2.play();
        }
    });
    

提交回复
热议问题