Example usage for javafx.animation FadeTransition setAutoReverse

List of usage examples for javafx.animation FadeTransition setAutoReverse

Introduction

In this page you can find the example usage for javafx.animation FadeTransition setAutoReverse.

Prototype

public final void setAutoReverse(boolean value) 

Source Link

Usage

From source file:Main.java

public static void startValueSetAnimation(final Pane parent) {
    final javafx.scene.shape.Rectangle rectangle = new javafx.scene.shape.Rectangle();
    Insets margin = BorderPane.getMargin(parent);
    if (margin == null) {
        margin = new Insets(0);
    }//from   w  w  w.j a v a  2  s  .  c  o m
    rectangle.widthProperty().bind(parent.widthProperty().subtract(margin.getLeft() + margin.getRight()));
    rectangle.heightProperty().bind(parent.heightProperty().subtract(margin.getTop() + margin.getBottom()));
    rectangle.setFill(Color.rgb(0, 150, 201));
    parent.getChildren().add(rectangle);

    BoxBlur bb = new BoxBlur();
    bb.setWidth(5);
    bb.setHeight(5);
    bb.setIterations(3);
    rectangle.setEffect(bb);

    FadeTransition ft = new FadeTransition(Duration.millis(250), rectangle);
    ft.setFromValue(0.2);
    ft.setToValue(0.8);
    ft.setCycleCount(2);
    ft.setAutoReverse(true);
    ft.play();
    ft.setOnFinished(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {
            parent.getChildren().remove(rectangle);
        }
    });
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("");
    Group root = new Group();
    Scene scene = new Scene(root, 300, 250, Color.WHITE);

    Group g = new Group();

    DropShadow ds = new DropShadow();
    ds.setOffsetY(3.0);/*from  w w w  . ja  va2  s. co  m*/
    ds.setColor(Color.color(0.4, 0.4, 0.4));

    Ellipse ellipse = new Ellipse();
    ellipse.setCenterX(50.0f);
    ellipse.setCenterY(50.0f);
    ellipse.setRadiusX(50.0f);
    ellipse.setRadiusY(25.0f);
    ellipse.setEffect(ds);

    FadeTransition ft = new FadeTransition(Duration.millis(3000), ellipse);
    ft.setFromValue(1.0);
    ft.setToValue(0.3);
    ft.setAutoReverse(true);

    ft.play();

    g.getChildren().add(ellipse);

    root.getChildren().add(g);
    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Group root = new Group();
    Scene scene = new Scene(root, 260, 80);
    stage.setScene(scene);/*from w  w w .  j av a 2s.c  om*/

    VBox vb = new VBox();

    Rectangle rect = new Rectangle(100, 40, 100, 100);
    rect.setArcHeight(50);
    rect.setArcWidth(50);
    rect.setFill(Color.VIOLET);

    final Duration SEC_2 = Duration.millis(2000);
    final Duration SEC_3 = Duration.millis(3000);

    FadeTransition ft = new FadeTransition(SEC_3);
    ft.setFromValue(1.0f);
    ft.setToValue(0.3f);

    ft.setAutoReverse(true);
    TranslateTransition tt = new TranslateTransition(SEC_2);
    tt.setFromX(-100f);
    tt.setToX(100f);

    tt.setAutoReverse(true);
    RotateTransition rt = new RotateTransition(SEC_3);
    rt.setByAngle(180f);

    rt.setAutoReverse(true);
    ScaleTransition st = new ScaleTransition(SEC_2);
    st.setByX(1.5f);
    st.setByY(1.5f);

    st.setAutoReverse(true);

    ParallelTransition pt = new ParallelTransition(rect, ft, tt, rt, st);
    pt.play();
    vb.getChildren().add(rect);

    scene.setRoot(vb);
    stage.show();
}

From source file:net.rptools.tokentool.controller.TokenTool_Controller.java

private void treeViewFinish() {
    log.info("***treeViewFinish called");
    // Sort the nodes off of root
    treeItems = sortTreeNodes(treeItems);

    updateOverlayTreeview(treeItems);/*from w ww  .j  a v a2 s  . c  o  m*/
    addPseudoClassToLeafs(overlayTreeView);
    updateOverlayTreeViewRecentFolder(false);

    // overlayNameLabel.setVisible(true);
    overlayTreeProgressBar.setStyle("-fx-accent: forestgreen;");
    progressBarLabel.setVisible(false);

    FadeTransition fadeOut = new FadeTransition(Duration.millis(2000));
    fadeOut.setNode(overlayTreeProgressBar);
    fadeOut.setFromValue(1.0);
    fadeOut.setToValue(0.0);
    fadeOut.setCycleCount(1);
    fadeOut.setAutoReverse(false);
    fadeOut.playFromStart();

    FadeTransition fadeIn = new FadeTransition(Duration.millis(4000));
    fadeIn.setNode(overlayNameLabel);
    fadeIn.setFromValue(0.0);
    fadeIn.setToValue(1.0);
    fadeIn.setCycleCount(1);
    fadeIn.setAutoReverse(false);
    fadeIn.playFromStart();

}

From source file:com.bekwam.resignator.ResignatorAppMainViewController.java

@FXML
public void showConsole(ActionEvent evt) {

    CheckMenuItem mi = (CheckMenuItem) evt.getSource();

    if (logger.isDebugEnabled()) {
        logger.debug("[SHOW] show={}", mi.isSelected());
    }/*from  w  w w.  j av  a 2s. c  o  m*/

    if (mi.isSelected() && !sp.getItems().contains(console)) {
        if (logger.isDebugEnabled()) {
            logger.debug("[SHOW] adding console region");
        }

        console.setOpacity(0.0d);

        sp.getItems().add(console);

        FadeTransition ft = new FadeTransition(Duration.millis(400), console);
        ft.setFromValue(0.0);
        ft.setToValue(1.0);
        ft.setCycleCount(1);
        ft.setAutoReverse(false);
        ft.play();

        return;
    }

    if (!mi.isSelected() && sp.getItems().contains(console)) {

        if (logger.isDebugEnabled()) {
            logger.debug("[SHOW] removing console region");
        }

        FadeTransition ft = new FadeTransition(Duration.millis(300), console);
        ft.setFromValue(1.0);
        ft.setToValue(0.1);
        ft.setCycleCount(1);
        ft.setAutoReverse(false);
        ft.play();

        ft.setOnFinished((e) -> sp.getItems().remove(console));
    }
}

From source file:com.bekwam.resignator.ResignatorAppMainViewController.java

@FXML
public void showProfileBrowser(ActionEvent evt) {

    CheckMenuItem mi = (CheckMenuItem) evt.getSource();

    if (logger.isDebugEnabled()) {
        logger.debug("[SHOW] show={}", mi.isSelected());
    }//www  . j  ava 2 s .  c o  m

    if (mi.isSelected() && !outerSp.getItems().contains(profileBrowser)) {
        if (logger.isDebugEnabled()) {
            logger.debug("[SHOW] adding profileBrowser region");
        }

        profileBrowser.setOpacity(0.0d);

        outerSp.getItems().add(0, profileBrowser);
        outerSp.setDividerPositions(0.3);

        FadeTransition ft = new FadeTransition(Duration.millis(400), profileBrowser);
        ft.setFromValue(0.0);
        ft.setToValue(1.0);
        ft.setCycleCount(1);
        ft.setAutoReverse(false);
        ft.play();

        return;
    }

    if (!mi.isSelected() && outerSp.getItems().contains(profileBrowser)) {

        if (logger.isDebugEnabled()) {
            logger.debug("[SHOW] removing profileBrowser region");
        }

        FadeTransition ft = new FadeTransition(Duration.millis(300), profileBrowser);
        ft.setFromValue(1.0);
        ft.setToValue(0.1);
        ft.setCycleCount(1);
        ft.setAutoReverse(false);
        ft.play();

        ft.setOnFinished((e) -> outerSp.getItems().remove(profileBrowser));
    }
}

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

private void fadeNode(Node node, double toValue, boolean block, Runnable onFinish) {
    guiAnimationQueue.submit(() -> {//w ww . j a v a 2 s  .  co m
        if (block) {
            guiAnimationQueue.setBlocked(true);
        }
        if (!node.isVisible()) {
            node.setOpacity(0);
            node.setVisible(true);
        }

        FadeTransition fadeTransition = new FadeTransition();
        fadeTransition.setNode(node);
        fadeTransition.setFromValue(node.getOpacity());
        fadeTransition.setToValue(toValue);
        fadeTransition.setDuration(Duration.seconds(animationSpeed));
        fadeTransition.setAutoReverse(false);

        fadeTransition.setOnFinished((event) -> {
            if (toValue == 0) {
                node.setEffect(null);
                node.setVisible(false);
            }
            if (block) {
                guiAnimationQueue.setBlocked(false);
            }
            if (onFinish != null) {
                onFinish.run();
            }
        });

        fadeTransition.play();
    });
}

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();// w w  w  .j  a v  a  2  s.com

        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();
    });

}

From source file:pe.edu.system.jcmr.controlador.SplashController.java

public void start() {

    FadeTransition tt = new FadeTransition(Duration.seconds(16), stackMain);
    //         tt.setFromAngle(0);
    //         tt.setToAngle(360);
    //         tt.setAutoReverse(true);
    //         tt.setCycleCount(4);
    //         tt.setInterpolator(Interpolator.);
    //         tt.setAxis( Rotate.X_AXIS );

    tt.setAutoReverse(true);
    tt.setCycleCount(3);/*  www  .ja  v a  2  s  . c  o  m*/
    tt.setFromValue(1.0);
    tt.setToValue(0.0);

    RotateTransition rr = new RotateTransition(Duration.seconds(30), imgLogo);
    rr.setCycleCount(3);
    rr.setByAngle(360);

    //        rotator.setInterpolator(Interpolator.LINEAR);
    //                tt.setFromX( -(imgLogo.getFitWidth()) );
    //                tt.setToX( stackMain.getPrefWidth() );
    //                tt.setCycleCount( Timeline.INDEFINITE );
    //                tt.play();
    rr.play();
}

From source file:pe.edu.system.jcmr.controlador.SplashController.java

public void start2() {

    FadeTransition tt = new FadeTransition(Duration.seconds(16), stackMain);
    //         tt.setFromAngle(0);
    //         tt.setToAngle(360);
    //         tt.setAutoReverse(true);
    //         tt.setCycleCount(4);
    //         tt.setInterpolator(Interpolator.);
    //         tt.setAxis( Rotate.X_AXIS );

    tt.setAutoReverse(true);
    tt.setCycleCount(3);//  w w w .  j  ava 2  s  . c o m
    tt.setFromValue(1.0);
    tt.setToValue(0.0);

    RotateTransition rr = new RotateTransition(Duration.seconds(30), imgLogo2);
    rr.setCycleCount(3);
    rr.setByAngle(360);

    //        rotator.setInterpolator(Interpolator.LINEAR);
    //                tt.setFromX( -(imgLogo.getFitWidth()) );
    //                tt.setToX( stackMain.getPrefWidth() );
    //                tt.setCycleCount( Timeline.INDEFINITE );
    //                tt.play();
    rr.play();
}