Example usage for javafx.animation PauseTransition setOnFinished

List of usage examples for javafx.animation PauseTransition setOnFinished

Introduction

In this page you can find the example usage for javafx.animation PauseTransition setOnFinished.

Prototype

public final void setOnFinished(EventHandler<ActionEvent> value) 

Source Link

Usage

From source file:com.github.naoghuman.testdata.abclist.service.ExerciseService.java

@Override
public void start() {
    final SequentialTransition sequentialTransition = new SequentialTransition();

    final PauseTransition ptProgressBarInformation = new PauseTransition();
    ptProgressBarInformation.setDuration(Duration.millis(250.0d));
    ptProgressBarInformation.setOnFinished((ActionEvent event) -> {
        presenter.setProgressBarInformation(onStartMessage);
    });/*from w w w  .  j  a  v a 2 s . c o m*/
    sequentialTransition.getChildren().add(ptProgressBarInformation);

    final PauseTransition ptStart = new PauseTransition();
    ptStart.setDuration(Duration.millis(1000.0d));
    ptStart.setOnFinished((ActionEvent event) -> {
        super.start();
    });
    sequentialTransition.getChildren().add(ptStart);

    sequentialTransition.playFromStart();
}

From source file:com.github.vatbub.tictactoe.view.Main.java

private void showLooser(Board.WinnerInfo winnerInfo) {
    String looserName = board.getOpponent(winnerInfo.winningPlayer).getName();
    guiAnimationQueue.submitWaitForUnlock(() -> {
        ShakeTransition anim = new ShakeTransition(gamePane, null);
        anim.playFromStart();//from   w  w  w  .  j a  va2 s. co m

        Timeline timeline = new Timeline();

        Circle c1 = new Circle((452 / 600.0) * looserPane.getWidth(), (323 / 640.0) * looserPane.getHeight(),
                0);
        GaussianBlur circleBlur = new GaussianBlur(30);
        c1.setEffect(circleBlur);
        looseImage.setClip(c1);
        addWinLineOnLoose(winnerInfo);

        KeyValue keyValue1 = new KeyValue(c1.radiusProperty(), 0);
        KeyFrame keyFrame1 = new KeyFrame(Duration.millis(800), keyValue1);
        KeyValue keyValue2 = new KeyValue(c1.radiusProperty(), (500 / 640.0) * looserPane.getHeight());
        KeyFrame keyFrame2 = new KeyFrame(Duration.millis(900), keyValue2);

        timeline.getKeyFrames().addAll(keyFrame1, keyFrame2);

        looseMessage.setOpacity(0);
        looserText.setText(looserName + " lost :(");
        looserPane.setVisible(true);
        looserPane.setOpacity(1);

        timeline.setOnFinished((event) -> {
            looseImage.setClip(null);
            winLineGroup.setClip(null);
            blurGamePane();
            PauseTransition wait = new PauseTransition();
            wait.setDuration(Duration.seconds(1));
            wait.setOnFinished((event2) -> {
                FadeTransition looseMessageTransition = new FadeTransition();
                looseMessageTransition.setNode(looseMessage);
                looseMessageTransition.setFromValue(0);
                looseMessageTransition.setToValue(1);
                looseMessageTransition.setDuration(Duration.millis(500));
                looseMessageTransition.setAutoReverse(false);
                looseMessageTransition.play();
            });

            wait.play();
        });

        timeline.play();
    });

}