Example usage for javafx.animation FadeTransition FadeTransition

List of usage examples for javafx.animation FadeTransition FadeTransition

Introduction

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

Prototype

public FadeTransition(Duration duration, Node node) 

Source Link

Document

The constructor of FadeTransition

Usage

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    Group group = new Group();

    Rectangle rect = new Rectangle(20, 20, 200, 200);

    FadeTransition ft = new FadeTransition(Duration.millis(5000), rect);
    ft.setFromValue(1.0);/*from   w w w . jav a  2  s.  c o m*/
    ft.setToValue(0.0);
    ft.play();

    group.getChildren().add(rect);

    Scene scene = new Scene(group, 300, 200);
    primaryStage.setScene(scene);
    primaryStage.show();
}

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 av  a  2 s. co 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);//w ww .  j  a va2  s.  c  o 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:mesclasses.view.RootLayoutController.java

private void displayNotification(int type, String texte) {
    notificationMessageLabel.setText(texte);
    notificationPane.getStyleClass().clear();
    CssUtil.removeClass(deleteNotifBtn, "notif-warning");
    CssUtil.removeClass(deleteNotifBtn, "notif-error");
    Double timeDisplayed = 3.0D;/*from w w w .j  a v  a2  s  . c  om*/
    switch (type) {
    case MessageEvent.SUCCESS:
        CssUtil.addClass(notificationPane, "notif-success");
        deleteNotifBtn.setManaged(false);
        deleteNotifBtn.setVisible(false);
        notificationTitleLabel.setText("SUCCES");
        break;
    case MessageEvent.WARNING:
        CssUtil.addClass(notificationPane, "notif-warning");
        CssUtil.addClass(deleteNotifBtn, "notif-warning");
        notificationTitleLabel.setText("ATTENTION");
        break;
    case MessageEvent.ERROR:
        CssUtil.addClass(notificationPane, "notif-error");
        CssUtil.addClass(deleteNotifBtn, "notif-error");
        notificationTitleLabel.setText("ERREUR");
        timeDisplayed = 0.0;
        break;
    }
    notificationPane.setManaged(true);
    notificationPane.setVisible(true);

    if (timeDisplayed > 0.0) {
        FadeTransition ft = new FadeTransition(Duration.millis(150), notificationPane);
        ft.setFromValue(0.0);
        ft.setToValue(1.0);
        ft.setCycleCount(1);
        ft.play();
        Timeline timeline = new Timeline();
        timeline.getKeyFrames().add(new KeyFrame(Duration.seconds(timeDisplayed), (ActionEvent event) -> {
            FadeTransition ft2 = new FadeTransition(Duration.millis(150), notificationPane);
            ft2.setFromValue(1.0);
            ft2.setToValue(0.0);
            ft2.setCycleCount(1);
            ft2.play();
            ft2.setOnFinished((ActionEvent event1) -> {
                notificationPane.setManaged(false);
                notificationPane.setVisible(false);
            });

        }));
        timeline.play();
    }
}

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());
    }//  ww w  .  j ava 2  s . c om

    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());
    }//from   www.j  a  v a2  s .  co  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:org.jevis.jeconfig.JEConfig.java

/**
 * Build an new JEConfig Login and main frame/stage
 *
 * @param primaryStage//from   ww w  .j ava2s. c o m
 */
//AITBilal - Login  
private void initGUI(Stage primaryStage) {
    Scene scene;
    LoginGlass login = new LoginGlass(primaryStage);

    AnchorPane jeconfigRoot = new AnchorPane();
    AnchorPane.setTopAnchor(jeconfigRoot, 0.0);
    AnchorPane.setRightAnchor(jeconfigRoot, 0.0);
    AnchorPane.setLeftAnchor(jeconfigRoot, 0.0);
    AnchorPane.setBottomAnchor(jeconfigRoot, 0.0);
    //        jeconfigRoot.setStyle("-fx-background-color: white;");
    //        jeconfigRoot.getChildren().setAll(new Label("sodfhsdhdsofhdshdsfdshfjf"));

    Screen screen = Screen.getPrimary();
    Rectangle2D bounds = screen.getVisualBounds();

    // @AITBilal - Main frame elemente wird aufgerufen nachdem man sich eingeloggt hat.
    login.getLoginStatus().addListener(new ChangeListener<Boolean>() {

        @Override
        public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
            if (newValue) {
                System.out.println("after request");
                _mainDS = login.getDataSource();
                ds = _mainDS;

                Platform.runLater(new Runnable() {
                    @Override
                    public void run() {
                        FadeTransition ft = new FadeTransition(Duration.millis(1500), login);
                        ft.setFromValue(1.0);
                        ft.setToValue(0);
                        ft.setCycleCount(1);
                        ft.play();
                    }
                });

                JEConfig.PROGRAMM_INFO.setJEVisAPI(ds.getInfo());
                JEConfig.PROGRAMM_INFO.addLibrary(org.jevis.commons.application.Info.INFO);
                JEConfig.PROGRAMM_INFO.addLibrary(org.jevis.application.Info.INFO);

                preLodedClasses = login.getAllClasses();
                preLodedRootObjects = login.getRootObjects();

                PluginManager pMan = new PluginManager(ds);
                //@AITBilal - Toolbar fr save, newB, delete, sep1, form
                GlobalToolBar toolbar = new GlobalToolBar(pMan);
                pMan.addPluginsByUserSetting(null);

                //                    StackPane root = new StackPane();
                //                    root.setId("mainpane");
                BorderPane border = new BorderPane();
                VBox vbox = new VBox();
                vbox.getChildren().addAll(new TopMenu(), toolbar.ToolBarFactory());
                border.setTop(vbox);
                //@AITBilal - Alle Plugins Inhalt fr JEConfig (Resources... | System | Attribute)
                border.setCenter(pMan.getView());

                Statusbar statusBar = new Statusbar(ds);

                border.setBottom(statusBar);

                System.out.println("show welcome");

                //Disable GUI is StatusBar note an disconnect
                border.disableProperty().bind(statusBar.connectedProperty.not());

                Platform.runLater(new Runnable() {
                    @Override
                    public void run() {
                        AnchorPane.setTopAnchor(border, 0.0);
                        AnchorPane.setRightAnchor(border, 0.0);
                        AnchorPane.setLeftAnchor(border, 0.0);
                        AnchorPane.setBottomAnchor(border, 0.0);

                        jeconfigRoot.getChildren().setAll(border);
                        //                            try {
                        //            WelcomePage welcome = new WelcomePage(primaryStage, new URI("http://coffee-project.eu/"));
                        //            WelcomePage welcome = new WelcomePage(primaryStage, new URI("http://openjevis.org/projects/openjevis/wiki/JEConfig3#JEConfig-Version-3"));

                        //                            Task<Void> showWelcome = new Task<Void>() {
                        //                                @Override
                        //                                protected Void call() throws Exception {
                        try {
                            WelcomePage welcome = new WelcomePage(primaryStage, _config.getWelcomeURL());
                        } catch (URISyntaxException ex) {
                            Logger.getLogger(JEConfig.class.getName()).log(Level.SEVERE, null, ex);
                        } catch (MalformedURLException ex) {
                            Logger.getLogger(JEConfig.class.getName()).log(Level.SEVERE, null, ex);
                        }
                        //                                    return null;
                        //                                }
                        //                            };
                        //                            new Thread(showWelcome).start();

                        //                                WelcomePage welcome = new WelcomePage(primaryStage, _config.getWelcomeURL());
                        //                            } catch (URISyntaxException ex) {
                        //                                Logger.getLogger(JEConfig.class.getName()).log(Level.SEVERE, null, ex);
                        //                            } catch (MalformedURLException ex) {
                        //                                Logger.getLogger(JEConfig.class.getName()).log(Level.SEVERE, null, ex);
                        //                            }
                    }
                });
            }

        }
    });

    AnchorPane.setTopAnchor(login, 0.0);
    AnchorPane.setRightAnchor(login, 0.0);
    AnchorPane.setLeftAnchor(login, 0.0);
    AnchorPane.setBottomAnchor(login, 0.0);
    //@AITBilal - Login Dialog
    scene = new Scene(jeconfigRoot, bounds.getWidth(), bounds.getHeight());
    scene.getStylesheets().add("/styles/Styles.css");
    primaryStage.getIcons().add(getImage("1393354629_Config-Tools.png"));
    primaryStage.setTitle("JEConfig");
    primaryStage.setScene(scene);
    maximize(primaryStage);
    primaryStage.show();

    //        Platform.runLater(new Runnable() {
    //            @Override
    //            public void run() {
    //@AITBilal - Inhalt bzw. die Elemente von LoginDialog
    jeconfigRoot.getChildren().setAll(login);
    //            }
    //        });

    primaryStage.onCloseRequestProperty().addListener(new ChangeListener<EventHandler<WindowEvent>>() {

        @Override
        public void changed(ObservableValue<? extends EventHandler<WindowEvent>> ov,
                EventHandler<WindowEvent> t, EventHandler<WindowEvent> t1) {
            try {
                System.out.println("Disconnect");
                ds.disconnect();
            } catch (JEVisException ex) {
                Logger.getLogger(JEConfig.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    });
}

From source file:org.noroomattheinn.visibletesla.LocationController.java

private Animation animateBlip() {
    final Circle core = new Circle(572, 360, 5);
    final Circle blip = new Circle(572, 360, 5);
    final Circle outline = new Circle(572, 360, 5);
    Duration blipTime = Duration.seconds(1.5);
    Duration interBlipTime = Duration.seconds(0.5);

    core.setFill(Color.BLUE);/*ww  w.  j a va2  s.  c  o m*/
    blip.setFill(Color.LIGHTBLUE);
    outline.setFill(Color.TRANSPARENT);
    outline.setStroke(Color.DARKBLUE);
    outline.setStrokeWidth(0.25);

    root.getChildren().addAll(blip, core, outline);

    FadeTransition fadeBlip = new FadeTransition(blipTime, blip);
    fadeBlip.setFromValue(0.8);
    fadeBlip.setToValue(0.0);

    ScaleTransition scaleBlip = new ScaleTransition(blipTime, blip);
    scaleBlip.setFromX(1);
    scaleBlip.setToX(4);
    scaleBlip.setFromY(1);
    scaleBlip.setToY(4);

    FadeTransition fadeOutline = new FadeTransition(blipTime, outline);
    fadeOutline.setFromValue(1.0);
    fadeOutline.setToValue(0.0);

    ScaleTransition scaleOutline = new ScaleTransition(blipTime, outline);
    scaleOutline.setFromX(1);
    scaleOutline.setToX(4);
    scaleOutline.setFromY(1);
    scaleOutline.setToY(4);

    SequentialTransition sequence = new SequentialTransition(
            new ParallelTransition(fadeBlip, scaleBlip, scaleOutline, fadeOutline),
            new PauseTransition(interBlipTime));
    sequence.setCycleCount(Timeline.INDEFINITE);
    sequence.setOnFinished(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent t) {
            core.setVisible(false);
            blip.setVisible(false);
            outline.setVisible(false);
        }
    });

    sequence.play();
    return sequence;
}

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);//from   www  .  j ava2 s. c  o m
    tt.setCycleCount(3);
    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);//from   w  w w.  j a v  a  2  s. co m
    tt.setCycleCount(3);
    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();
}