Java Code Examples for javafx.animation.ParallelTransition#setOnFinished()

The following examples show how to use javafx.animation.ParallelTransition#setOnFinished() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LaunchScreeenController.java    From FakeImageDetection with GNU General Public License v3.0 6 votes vote down vote up
private void animate() {
    TranslateTransition tt = new TranslateTransition(Duration.millis(duration), load_image_button);
    TranslateTransition tLogo = new TranslateTransition(Duration.millis(duration), christopher);
    TranslateTransition tDesc = new TranslateTransition(Duration.millis(duration), description);

    ScaleTransition st = new ScaleTransition(Duration.millis(duration), load_image_button);
    st.setToX(3);
    st.setToY(3);

    tt.setByY(-180f);

    tLogo.setToY(50);
    tDesc.setToY(500);
    buttonParallelTransition = new ParallelTransition(load_image_button, st, tt, tLogo, tDesc);

    buttonParallelTransition.play();
    buttonParallelTransition.setOnFinished((e) -> {
        load_image_button.setOpacity(1);
    });
}
 
Example 2
Source File: CloudFadeOutStep.java    From TweetwallFX with MIT License 6 votes vote down vote up
@Override
public void doStep(final MachineContext context) {
    WordleSkin wordleSkin = (WordleSkin) context.get("WordleSkin");

    List<Transition> fadeOutTransitions = new ArrayList<>();

    Duration defaultDuration = Duration.seconds(1.5);

    // kill the remaining words from the cloud
    wordleSkin.word2TextMap.entrySet().forEach(entry -> {
        Text textNode = entry.getValue();
        FadeTransition ft = new FadeTransition(defaultDuration, textNode);
        ft.setToValue(0);
        ft.setOnFinished(event
                -> wordleSkin.getPane().getChildren().remove(textNode));
        fadeOutTransitions.add(ft);
    });
    wordleSkin.word2TextMap.clear();

    ParallelTransition fadeLOuts = new ParallelTransition();

    fadeLOuts.getChildren().addAll(fadeOutTransitions);
    fadeLOuts.setOnFinished(e -> context.proceed());
    fadeLOuts.play();
}
 
Example 3
Source File: NodeFadeOutStep.java    From TweetwallFX with MIT License 5 votes vote down vote up
@Override
public void doStep(final StepEngine.MachineContext context) {
    final WordleSkin wordleSkin = (WordleSkin) context.get("WordleSkin");
    final Set<Node> nodes = wordleSkin.getNode().lookupAll(config.getNodeSelector());

    final ParallelTransition fadeOutAll = new ParallelTransition();
    nodes.forEach(node ->  {
        fadeOutAll.getChildren().add(new FlipOutXTransition(node));
    });
    fadeOutAll.setOnFinished(e -> {
        wordleSkin.getPane().getChildren().removeAll(nodes);
        context.proceed();
    });
    fadeOutAll.play();
}
 
Example 4
Source File: ImageMosaicStep.java    From TweetwallFX with MIT License 5 votes vote down vote up
private Transition createReverseHighlightAndZoomTransition(final int column, final int row) {
    ImageView randomView = rects[column][row];
    randomView.toFront();
    ParallelTransition firstParallelTransition = new ParallelTransition();
    ParallelTransition secondParallelTransition = new ParallelTransition();

    for (int i = 0; i < 6; i++) {
        for (int j = 0; j < 5; j++) {
            if ((i == column) && (j == row)) {
                continue;
            }
            FadeTransition ft = new FadeTransition(Duration.seconds(1), rects[i][j]);
            ft.setFromValue(0.3);
            ft.setToValue(1.0);
            firstParallelTransition.getChildren().add(ft);
        }
    }

    double width = pane.getWidth() / 6.0 - 10;
    double height = pane.getHeight() / 5.0 - 8;

    final SizeTransition zoomBox = new SizeTransition(Duration.seconds(2.5), randomView.fitWidthProperty(), randomView.fitHeightProperty())
            .withWidth(randomView.getLayoutBounds().getWidth(), width)
            .withHeight(randomView.getLayoutBounds().getHeight(), height);
    final LocationTransition trans = new LocationTransition(Duration.seconds(2.5), randomView)
            .withX(randomView.getLayoutX(), bounds[column][row].getMinX())
            .withY(randomView.getLayoutY(), bounds[column][row].getMinY());
    secondParallelTransition.getChildren().addAll(trans, zoomBox);

    SequentialTransition seqT = new SequentialTransition();
    seqT.getChildren().addAll(secondParallelTransition, firstParallelTransition);

    secondParallelTransition.setOnFinished(event
            -> randomView.setEffect(null));

    return seqT;
}
 
Example 5
Source File: HeatControlSkin.java    From Enzo with Apache License 2.0 5 votes vote down vote up
private void fadeBack() {
    FadeTransition fadeInfoTextOut = new FadeTransition(Duration.millis(425), infoText);
    fadeInfoTextOut.setFromValue(1.0);
    fadeInfoTextOut.setToValue(0.0);
    
    FadeTransition fadeValueOut = new FadeTransition(Duration.millis(425), value);
    fadeValueOut.setFromValue(1.0);
    fadeValueOut.setToValue(0.0);

    PauseTransition pause = new PauseTransition(Duration.millis(50));

    FadeTransition fadeInfoTextIn = new FadeTransition(Duration.millis(425), infoText);
    fadeInfoTextIn.setFromValue(0.0);
    fadeInfoTextIn.setToValue(1.0);
    
    FadeTransition fadeValueIn = new FadeTransition(Duration.millis(425), value);
    fadeValueIn.setFromValue(0.0);
    fadeValueIn.setToValue(1.0);                
    
    ParallelTransition parallelIn = new ParallelTransition(fadeInfoTextIn, fadeValueIn);

    ParallelTransition parallelOut = new ParallelTransition(fadeInfoTextOut, fadeValueOut);
    parallelOut.setOnFinished(event -> {
        double currentValue = (valueIndicatorRotate.getAngle() + getSkinnable().getStartAngle() - 180) / angleStep + getSkinnable().getMinValue();
        value.setText(String.format(Locale.US, "%." + getSkinnable().getDecimals() + "f", currentValue));
        value.setTranslateX((size - value.getLayoutBounds().getWidth()) * 0.5);
        if (getSkinnable().getTarget() < getSkinnable().getValue()) {
            getSkinnable().setInfoText("COOLING");
        } else if (getSkinnable().getTarget() > getSkinnable().getValue()) {
            getSkinnable().setInfoText("HEATING");
        }
        
        resizeText();
        drawTickMarks(ticks);
        userAction = false;
    });

    SequentialTransition sequence = new SequentialTransition(parallelOut, pause, parallelIn);
    sequence.play();
}
 
Example 6
Source File: RadialBargraphSkin.java    From Enzo with Apache License 2.0 5 votes vote down vote up
private void fadeBackToInteractive() {
    FadeTransition fadeUnitOut = new FadeTransition(Duration.millis(425), unit);
    fadeUnitOut.setFromValue(1.0);
    fadeUnitOut.setToValue(0.0);
    FadeTransition fadeValueOut = new FadeTransition(Duration.millis(425), value);
    fadeValueOut.setFromValue(1.0);
    fadeValueOut.setToValue(0.0);

    PauseTransition pause = new PauseTransition(Duration.millis(50));

    FadeTransition fadeUnitIn = new FadeTransition(Duration.millis(425), unit);
    fadeUnitIn.setFromValue(0.0);
    fadeUnitIn.setToValue(1.0);
    FadeTransition fadeValueIn = new FadeTransition(Duration.millis(425), value);
    fadeValueIn.setFromValue(0.0);
    fadeValueIn.setToValue(1.0);
    ParallelTransition parallelIn = new ParallelTransition(fadeUnitIn, fadeValueIn);

    ParallelTransition parallelOut = new ParallelTransition(fadeUnitOut, fadeValueOut);
    parallelOut.setOnFinished(event -> {
        unit.setText("Interactive");
        value.setText("");
        resizeText();
    });

    SequentialTransition sequence = new SequentialTransition(parallelOut, pause, parallelIn);
    sequence.play();
}
 
Example 7
Source File: GaugeSkin.java    From Enzo with Apache License 2.0 5 votes vote down vote up
private void fadeBackToInteractive() {
    FadeTransition fadeUnitOut = new FadeTransition(Duration.millis(425), unit);
    fadeUnitOut.setFromValue(1.0);
    fadeUnitOut.setToValue(0.0);
    FadeTransition fadeValueOut = new FadeTransition(Duration.millis(425), value);
    fadeValueOut.setFromValue(1.0);
    fadeValueOut.setToValue(0.0);

    PauseTransition pause = new PauseTransition(Duration.millis(50));

    FadeTransition fadeUnitIn = new FadeTransition(Duration.millis(425), unit);
    fadeUnitIn.setFromValue(0.0);
    fadeUnitIn.setToValue(1.0);
    FadeTransition fadeValueIn = new FadeTransition(Duration.millis(425), value);
    fadeValueIn.setFromValue(0.0);
    fadeValueIn.setToValue(1.0);
    ParallelTransition parallelIn = new ParallelTransition(fadeUnitIn, fadeValueIn);

    ParallelTransition parallelOut = new ParallelTransition(fadeUnitOut, fadeValueOut);
    parallelOut.setOnFinished(event -> {
        unit.setText("Interactive");
        value.setText("");
        resizeText();
    });

    SequentialTransition sequence = new SequentialTransition(parallelOut, pause, parallelIn);
    sequence.play();
}
 
Example 8
Source File: MainNode.java    From helloiot with GNU General Public License v3.0 4 votes vote down vote up
public void initialize() {

        if (appexitbutton) {
            exitbutton.setVisible(true);
            exitbutton.setGraphic(IconBuilder.create(IconFontGlyph.FA_SOLID_POWER_OFF, 18.0).styleClass("icon-fill").build());
            exitbutton.setOnAction(ev -> {
                rootpane.getScene().getWindow().hide();
            });
        } else {
            exitbutton.setVisible(false);
            headerbox.getChildren().remove(exitbutton);
            exitbutton = null;
        }
        menubutton.setGraphic(IconBuilder.create(IconFontGlyph.FA_SOLID_BARS, 18.0).styleClass("icon-fill").build());
        menubutton.setDisable(true);
        
        timeindicator = new TimeIndicator(resources.getString("clock.pattern"));
        indicators.getChildren().add(timeindicator.getNode());
        
        listpagesgray.setBackground(new Background(new BackgroundFill(Color.gray(0.5, 0.75), CornerRadii.EMPTY, Insets.EMPTY)));
        FadeTransition ft = new FadeTransition(Duration.millis(300), scrollpages);
        ft.setFromValue(0.0);
        ft.setToValue(1.0);
        ft.setInterpolator(Interpolator.LINEAR);
        FadeTransition ft2 = new FadeTransition(Duration.millis(300), listpagesgray);
        ft2.setFromValue(0.0);
        ft2.setToValue(1.0);
        ft2.setInterpolator(Interpolator.LINEAR);
        TranslateTransition tt = new TranslateTransition(Duration.millis(300), scrollpages);
        tt.setFromX(-scrollpages.prefWidth(0));
        tt.setToX(0.0);
        tt.setInterpolator(Interpolator.EASE_BOTH);
        TranslateTransition tt2 = new TranslateTransition(Duration.millis(300), appcontainer);
        tt2.setFromX(0.0);
        tt2.setToX(scrollpages.prefWidth(0));
        tt2.setInterpolator(Interpolator.EASE_BOTH);
        
        listpagestransition = new ParallelTransition(ft, ft2, tt, tt2);
        listpagestransition.setRate(-1.0);
        listpagestransition.setOnFinished((ActionEvent actionEvent) -> {
            if (listpagestransition.getCurrentTime().equals(Duration.ZERO)) {
                scrollpages.setVisible(false);
                listpagesgray.setVisible(false);
            }
        });
    }