javafx.animation.FadeTransition Java Examples

The following examples show how to use javafx.animation.FadeTransition. 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: VolumeChart.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
protected void dataItemRemoved(XYChart.Data<Number, Number> item, XYChart.Series<Number, Number> series) {
    final Node node = item.getNode();
    if (shouldAnimate()) {
        FadeTransition ft = new FadeTransition(Duration.millis(500), node);
        ft.setToValue(0);
        ft.setOnFinished((ActionEvent actionEvent) -> {
            getPlotChildren().remove(node);
            removeDataItemFromDisplay(series, item);
        });
        ft.play();
    } else {
        getPlotChildren().remove(node);
        removeDataItemFromDisplay(series, item);
    }
}
 
Example #2
Source File: Movimientos.java    From uip-pc2 with MIT License 6 votes vote down vote up
public void salir(MouseEvent mouseEvent) {
    Stage stage = (Stage) salir.getScene().getWindow();
    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("Login.fxml"));
    Parent root = null;
    try {
        root = fxmlLoader.load();
    } catch (Exception e) {
        Alert alerta = new Alert(Alert.AlertType.ERROR);
        alerta.setTitle("Error de Aplicación");
        alerta.setContentText("Llama al lapecillo de sistemas.");
        alerta.showAndWait();
        Platform.exit();
    }
    FadeTransition ft = new FadeTransition(Duration.millis(1500), root);
    ft.setFromValue(0.0);
    ft.setToValue(1.0);
    ft.play();
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();
}
 
Example #3
Source File: LoadingPane.java    From Quelea with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Create the loading pane.
 */
public LoadingPane() {
    setAlignment(Pos.CENTER);
    VBox content = new VBox();
    content.setAlignment(Pos.CENTER);
    Text text = new Text(LabelGrabber.INSTANCE.getLabel("loading.text") + "...");
    text.setStyle(" -fx-font: bold italic 20pt \"Arial\";");
    FadeTransition textTransition = new FadeTransition(Duration.seconds(1.5), text);
    textTransition.setAutoReverse(true);
    textTransition.setFromValue(0);
    textTransition.setToValue(1);
    textTransition.setCycleCount(Transition.INDEFINITE);
    textTransition.play();
    content.getChildren().add(text);
    bar = new ProgressBar();
    content.getChildren().add(bar);
    getChildren().add(content);
    setOpacity(0);
    setStyle("-fx-background-color: #555555;");
    setVisible(false);
}
 
Example #4
Source File: Transferencia.java    From uip-pc2 with MIT License 6 votes vote down vote up
public void atras(MouseEvent mouseEvent) {
    Stage stage = (Stage) atras.getScene().getWindow();
    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("Resumen.fxml"));
    Parent root = null;
    try {
        root = fxmlLoader.load();
    } catch (Exception e) {
        Alert alerta = new Alert(Alert.AlertType.ERROR);
        alerta.setTitle("Error de Aplicación");
        alerta.setContentText("Llama al lapecillo de sistemas.");
        alerta.showAndWait();
        Platform.exit();
    }
    FadeTransition ft = new FadeTransition(Duration.millis(1500), root);
    ft.setFromValue(0.0);
    ft.setToValue(1.0);
    ft.play();
    Resumen controller = fxmlLoader.<Resumen>getController();
    controller.setCuenta();
    controller.setSaldo();
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();
}
 
Example #5
Source File: RadialMenu.java    From Enzo with Apache License 2.0 6 votes vote down vote up
public void close() {
    if (State.CLOSED == getState()) return;

    setState(State.CLOSED);
    RotateTransition rotate = new RotateTransition();
    rotate.setNode(cross);
    rotate.setToAngle(0);
    rotate.setDuration(Duration.millis(200));
    rotate.setInterpolator(Interpolator.EASE_BOTH);
    rotate.play();
    closeTimeLines[closeTimeLines.length - 1].setOnFinished(actionEvent -> {
        FadeTransition buttonFadeOut = new FadeTransition();
        buttonFadeOut.setNode(mainMenuButton);
        buttonFadeOut.setDuration(Duration.millis(100));
        buttonFadeOut.setToValue(options.getButtonAlpha());
        buttonFadeOut.play();
        buttonFadeOut.setOnFinished(event -> {
            if (options.isButtonHideOnClose()) hide();
            fireMenuEvent(new MenuEvent(this, null, MenuEvent.MENU_CLOSE_FINISHED));
        });
    });
    for (int i = 0 ; i < closeTimeLines.length ; i++) {
        closeTimeLines[i].play();
    }
    fireMenuEvent(new MenuEvent(this, null, MenuEvent.MENU_CLOSE_STARTED));
}
 
Example #6
Source File: VolumeChart.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
protected void seriesRemoved(XYChart.Series<Number, Number> series) {
    for (XYChart.Data<Number, Number> d : series.getData()) {
        final Node volumeBar = d.getNode();
        if (shouldAnimate()) {
            FadeTransition ft = new FadeTransition(Duration.millis(500), volumeBar);
            ft.setToValue(0);
            ft.setOnFinished((ActionEvent actionEvent) -> getPlotChildren().remove(volumeBar));
            ft.play();
        } else {
            getPlotChildren().remove(volumeBar);
        }
    }
    if (shouldAnimate()) {
        new Timeline(new KeyFrame(Duration.millis(500), event -> removeSeriesFromDisplay(series))).play();
    } else {
        removeSeriesFromDisplay(series);
    }
}
 
Example #7
Source File: Controller2.java    From uip-pc2 with MIT License 6 votes vote down vote up
public void salir(ActionEvent actionEvent) {
    Stage stage = (Stage) btn_salir.getScene().getWindow();
    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("sample.fxml"));
    Parent root = null;
    try {
        root = fxmlLoader.load();
    } catch (Exception e) {
        Alert alerta = new Alert(Alert.AlertType.ERROR);
        alerta.setTitle("Error de Aplicación");
        alerta.setContentText("Llama al lapecillo de sistemas.");
        alerta.showAndWait();
        Platform.exit();
    }
    FadeTransition ft = new FadeTransition(Duration.millis(1500), root);
    ft.setFromValue(0.0);
    ft.setToValue(1.0);
    ft.play();
    //? controller = fxmlLoader.<?>getController();
    //controller.setConteo(conteo);
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();
}
 
Example #8
Source File: Secundario.java    From uip-pc2 with MIT License 6 votes vote down vote up
public void volver(ActionEvent actionEvent) {
    Stage stage = (Stage) btnvolver.getScene().getWindow();
    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("Principal.fxml"));
    Parent root = null;
    try {
        root = fxmlLoader.load();
    } catch (Exception e) {
        Alert alerta = new Alert(Alert.AlertType.ERROR);
        alerta.setTitle("Error de Aplicación");
        alerta.setContentText("Llama al lapecillo de sistemas.");
        alerta.showAndWait();
        Platform.exit();
    }
    FadeTransition ft = new FadeTransition(Duration.millis(1500), root);
    ft.setFromValue(0.0);
    ft.setToValue(1.0);
    ft.play();
    Principal controller = fxmlLoader.<Principal>getController();
    controller.setConteo(conteo);
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();
}
 
Example #9
Source File: CandleStickChart.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
protected void dataItemAdded(XYChart.Series<Number, Number> series, int itemIndex, XYChart.Data<Number, Number> item) {
    Node candle = createCandle(getData().indexOf(series), item, itemIndex);
    getPlotChildren().remove(candle);

    if (shouldAnimate()) {
        candle.setOpacity(0);
        getPlotChildren().add(candle);
        // fade in new candle
        FadeTransition ft = new FadeTransition(Duration.millis(500), candle);
        ft.setToValue(1);
        ft.play();
    } else {
        getPlotChildren().add(candle);
    }
    // always draw average line on top

    if (series.getNode() instanceof Path) {
        Path seriesPath = (Path) series.getNode();
        seriesPath.toFront();
    }
}
 
Example #10
Source File: TimelineChart.java    From constellation with Apache License 2.0 6 votes vote down vote up
@Override
protected void seriesRemoved(final Series<Number, Number> series) {

    final Node child = series.getNode();
    if (shouldAnimate()) {
        // fade out old item:
        final FadeTransition ft = new FadeTransition(Duration.millis(500), child);
        ft.setToValue(0);
        ft.setOnFinished(new EventHandler<ActionEvent>() {
            @Override
            public void handle(final ActionEvent actionEvent) {
                getPlotChildren().clear();
            }
        });
        ft.play();
    } else {
        getPlotChildren().clear();
    }
}
 
Example #11
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 #12
Source File: Transferencia.java    From uip-pc2 with MIT License 6 votes vote down vote up
public void salir(MouseEvent mouseEvent) {
    Stage stage = (Stage) salir.getScene().getWindow();
    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("Login.fxml"));
    Parent root = null;
    try {
        root = fxmlLoader.load();
    } catch (Exception e) {
        Alert alerta = new Alert(Alert.AlertType.ERROR);
        alerta.setTitle("Error de Aplicación");
        alerta.setContentText("Llama al lapecillo de sistemas.");
        alerta.showAndWait();
        Platform.exit();
    }
    FadeTransition ft = new FadeTransition(Duration.millis(1500), root);
    ft.setFromValue(0.0);
    ft.setToValue(1.0);
    ft.play();
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();
}
 
Example #13
Source File: Resumen.java    From uip-pc2 with MIT License 6 votes vote down vote up
public void transferir(ActionEvent actionEvent) {
    Stage stage = (Stage) movimientos.getScene().getWindow();
    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("Transferencia.fxml"));
    Parent root = null;
    try {
        root = fxmlLoader.load();
    } catch (Exception e) {
        Alert alerta = new Alert(Alert.AlertType.ERROR);
        alerta.setTitle("Error de Aplicación");
        alerta.setContentText("Llama al lapecillo de sistemas.");
        alerta.showAndWait();
        Platform.exit();
    }
    FadeTransition ft = new FadeTransition(Duration.millis(1500), root);
    ft.setFromValue(0.0);
    ft.setToValue(1.0);
    ft.play();
    Transferencia controller = fxmlLoader.<Transferencia>getController();
    controller.cargar_datos(cuenta.getText()); // ¯\_(ツ)_/¯ cuenta viene de la linea 27
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();
}
 
Example #14
Source File: GameElimniationController.java    From MyBox with Apache License 2.0 6 votes vote down vote up
protected void flush(int i, int j) {
    if (flushTimes < 1) {
        return;
    }
    try {
        FadeTransition fade = new FadeTransition(Duration.millis(flushDuration));
        fade.setFromValue(1.0);
        fade.setToValue(0f);
        fade.setCycleCount(flushTimes * 2);
        fade.setAutoReverse(true);
        fade.setNode(chessBoard.get(i + "-" + j));
        fade.play();
    } catch (Exception e) {
        logger.debug(e.toString());
    }
}
 
Example #15
Source File: TimelineChart.java    From constellation with Apache License 2.0 6 votes vote down vote up
@Override
protected void dataItemRemoved(final Data<Number, Number> item,
        final Series<Number, Number> series) {
    final Node child = item.getNode();

    if (shouldAnimate()) {
        // fade out old item:
        final FadeTransition ft = new FadeTransition(Duration.millis(500), child);
        ft.setToValue(0);
        ft.setOnFinished(new EventHandler<ActionEvent>() {
            @Override
            public void handle(final ActionEvent actionEvent) {
                getPlotChildren().remove(child);
            }
        });
        ft.play();
    } else {
        getPlotChildren().remove(child);
    }
}
 
Example #16
Source File: Sprite.java    From examples-javafx-repos1 with Apache License 2.0 6 votes vote down vote up
public void flagAsError() {
	
	this.normal.setVisible(true);  // hidden behind error
	this.highlight.setVisible(false);
	this.drag.setVisible(false);
	this.error.setVisible(true);
	
	FadeTransition ft = new FadeTransition(Duration.seconds(4), this.error);
    ft.setFromValue(1.0);
    ft.setToValue(0.0);
    ft.setOnFinished( (evt) -> {
    	
		this.normal.setVisible(true);  // show normal
		this.highlight.setVisible(false);
		this.drag.setVisible(false);
		this.error.setVisible(false);

    	this.error.setOpacity( 1.0d );  // restore opacity
    	
    });
    ft.play();
}
 
Example #17
Source File: AdvCandleStickChartSample.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
@Override protected void seriesAdded(Series<Number, Number> series, int seriesIndex) {
    // handle any data already in series
    for (int j = 0; j < series.getData().size(); j++) {
        Data item = series.getData().get(j);
        Node candle = createCandle(seriesIndex, item, j);
        if (shouldAnimate()) {
            candle.setOpacity(0);
            getPlotChildren().add(candle);
            // fade in new candle
            FadeTransition ft = new FadeTransition(Duration.millis(500), candle);
            ft.setToValue(1);
            ft.play();
        } else {
            getPlotChildren().add(candle);
        }
    }
    // create series path
    Path seriesPath = new Path();
    seriesPath.getStyleClass().setAll("candlestick-average-line", "series" + seriesIndex);
    series.setNode(seriesPath);
    getPlotChildren().add(seriesPath);
}
 
Example #18
Source File: JFXBadge.java    From JFoenix with Apache License 2.0 6 votes vote down vote up
public void refreshBadge() {
    badge.getChildren().clear();
    if (enabled) {


        Label labelControl = new Label(text.getValue());

        StackPane badgePane = new StackPane();
        badgePane.getStyleClass().add("badge-pane");
        badgePane.getChildren().add(labelControl);
        //Adding a clip would avoid overlap but this does not work as intended
        //badgePane.setClip(clip);
        badge.getChildren().add(badgePane);
        StackPane.setAlignment(badge, getPosition());

        FadeTransition ft = new FadeTransition(Duration.millis(666), badge);
        ft.setFromValue(0);
        ft.setToValue(1.0);
        ft.setCycleCount(1);
        ft.setAutoReverse(true);
        ft.play();
    }
}
 
Example #19
Source File: AdvCandleStickChartSample.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
@Override protected void dataItemAdded(Series<Number, Number> series, int itemIndex, Data<Number, Number> item) {
    Node candle = createCandle(getData().indexOf(series), item, itemIndex);
    if (shouldAnimate()) {
        candle.setOpacity(0);
        getPlotChildren().add(candle);
        // fade in new candle
        FadeTransition ft = new FadeTransition(Duration.millis(500), candle);
        ft.setToValue(1);
        ft.play();
    } else {
        getPlotChildren().add(candle);
    }
    // always draw average line on top
    if (series.getNode() != null) {
        series.getNode().toFront();
    }
}
 
Example #20
Source File: CardPlayedToken.java    From metastone with GNU General Public License v2.0 6 votes vote down vote up
public CardPlayedToken(GameBoardView boardView, Card card) {
	Window parent = boardView.getScene().getWindow();
	this.cardToken = new CardTooltip();

	popup = new Popup();
	popup.getContent().setAll(cardToken);
	popup.setX(parent.getX() + 40);
	popup.show(parent);
	popup.setY(parent.getY() + parent.getHeight() * 0.5 - cardToken.getHeight() * 0.5);

	cardToken.setCard(card);

	NotificationProxy.sendNotification(GameNotification.ANIMATION_STARTED);
	FadeTransition animation = new FadeTransition(Duration.seconds(1.2), cardToken);
	animation.setDelay(Duration.seconds(0.6f));
	animation.setOnFinished(this::onComplete);
	animation.setFromValue(1);
	animation.setToValue(0);
	animation.play();
}
 
Example #21
Source File: InfoPopup.java    From charts with Apache License 2.0 6 votes vote down vote up
private void init() {
    setAutoFix(true);
    rowCount = 2;

    fadeIn = new FadeTransition(Duration.millis(200), hBox);
    fadeIn.setFromValue(0);
    fadeIn.setToValue(0.75);

    fadeOut = new FadeTransition(Duration.millis(200), hBox);
    fadeOut.setFromValue(0.75);
    fadeOut.setToValue(0.0);
    fadeOut.setOnFinished(e -> hide());

    delay = new PauseTransition(Duration.millis(_timeout));
    delay.setOnFinished(e -> animatedHide());
}
 
Example #22
Source File: AdvCandleStickChartSample.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
@Override protected void seriesAdded(Series<Number, Number> series, int seriesIndex) {
    // handle any data already in series
    for (int j = 0; j < series.getData().size(); j++) {
        Data item = series.getData().get(j);
        Node candle = createCandle(seriesIndex, item, j);
        if (shouldAnimate()) {
            candle.setOpacity(0);
            getPlotChildren().add(candle);
            // fade in new candle
            FadeTransition ft = new FadeTransition(Duration.millis(500), candle);
            ft.setToValue(1);
            ft.play();
        } else {
            getPlotChildren().add(candle);
        }
    }
    // create series path
    Path seriesPath = new Path();
    seriesPath.getStyleClass().setAll("candlestick-average-line", "series" + seriesIndex);
    series.setNode(seriesPath);
    getPlotChildren().add(seriesPath);
}
 
Example #23
Source File: AdvCandleStickChartSample.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
@Override protected void dataItemRemoved(Data<Number, Number> item, Series<Number, Number> series) {
    final Node candle = item.getNode();
    if (shouldAnimate()) {
        // fade out old candle
        FadeTransition ft = new FadeTransition(Duration.millis(500), candle);
        ft.setToValue(0);
        ft.setOnFinished(new EventHandler<ActionEvent>() {

            @Override
            public void handle(ActionEvent actionEvent) {
                getPlotChildren().remove(candle);
            }
        });
        ft.play();
    } else {
        getPlotChildren().remove(candle);
    }
}
 
Example #24
Source File: AdvCandleStickChartSample.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
@Override protected void dataItemAdded(Series<Number, Number> series, int itemIndex, Data<Number, Number> item) {
    Node candle = createCandle(getData().indexOf(series), item, itemIndex);
    if (shouldAnimate()) {
        candle.setOpacity(0);
        getPlotChildren().add(candle);
        // fade in new candle
        FadeTransition ft = new FadeTransition(Duration.millis(500), candle);
        ft.setToValue(1);
        ft.play();
    } else {
        getPlotChildren().add(candle);
    }
    // always draw average line on top
    if (series.getNode() != null) {
        series.getNode().toFront();
    }
}
 
Example #25
Source File: RecordingListController.java    From archivo with GNU General Public License v3.0 6 votes vote down vote up
public RecordingListController(Archivo mainApp) {
    recordingSelection = new RecordingSelection();
    tivoIsBusy = new SimpleBooleanProperty(false);
    alreadyDefaultSorted = false;
    fadeTransition = new FadeTransition(javafx.util.Duration.millis(FADE_DURATION));
    this.mainApp = mainApp;
    tivos = FXCollections.synchronizedObservableList(FXCollections.observableArrayList());
    tablePlaceholderMessage = new Label("No recordings are available");
    tivoSelectedListener = (tivoList, oldTivo, curTivo) -> {
        logger.info("New TiVo selected: {}", curTivo);
        if (curTivo != null) {
            mainApp.setLastDevice(curTivo);
            fetchRecordingsFrom(curTivo);
        }
    };
}
 
Example #26
Source File: Resumen.java    From uip-pc2 with MIT License 6 votes vote down vote up
public void ver(ActionEvent actionEvent) {
    Stage stage = (Stage) movimientos.getScene().getWindow();
    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("Movimientos.fxml"));
    Parent root = null;
    try {
        root = fxmlLoader.load();
    } catch (Exception e) {
        Alert alerta = new Alert(Alert.AlertType.ERROR);
        alerta.setTitle("Error de Aplicación");
        alerta.setContentText("Llama al lapecillo de sistemas.");
        alerta.showAndWait();
        Platform.exit();
    }
    FadeTransition ft = new FadeTransition(Duration.millis(1500), root);
    ft.setFromValue(0.0);
    ft.setToValue(1.0);
    ft.play();
    Movimientos controller = fxmlLoader.<Movimientos>getController();
    controller.cargar_movimientos(cuenta.getText());
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();
}
 
Example #27
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 #28
Source File: NotificationsContainer.java    From pdfsam with GNU Affero General Public License v3.0 5 votes vote down vote up
private void fadeIn(Notification toAdd, EventHandler<ActionEvent> onFinished) {
    FadeTransition transition = new FadeTransition(Duration.millis(300), toAdd);
    transition.setFromValue(0);
    transition.setToValue(1);
    if (onFinished != null) {
        transition.setOnFinished(onFinished);
    }
    transition.play();
}
 
Example #29
Source File: SettingsActivity.java    From ApkToolPlus with Apache License 2.0 5 votes vote down vote up
public void close() {
    FadeTransition fadeTransition = AnimationHelper.fadeOut(event -> {
        ActivityManager.getRootView().getChildren().remove(getRootView());
    });
    fadeTransition.setNode(getRootView());
    fadeTransition.play();
    // 保存配置
    Config.save();
}
 
Example #30
Source File: TerasologyLauncher.java    From TerasologyLauncher with Apache License 2.0 5 votes vote down vote up
private void showSplashStage(final Stage initialStage, final Task<LauncherConfiguration> task) {
    progressText.textProperty().bind(task.messageProperty());
    loadProgress.progressProperty().bind(task.progressProperty());
    task.stateProperty().addListener((observableValue, oldState, newState) -> {
        if (newState == Worker.State.SUCCEEDED) {
            loadProgress.progressProperty().unbind();
            loadProgress.setProgress(1);
            if (mainStage != null) {
                mainStage.setIconified(false);
            }
            initialStage.toFront();
            FadeTransition fadeSplash = new FadeTransition(Duration.seconds(1.2), splashLayout);
            fadeSplash.setFromValue(1.0);
            fadeSplash.setToValue(0.0);
            fadeSplash.setOnFinished(actionEvent -> initialStage.hide());
            fadeSplash.play();
        } // todo add code to gracefully handle other task states.
    });

    decorateStage(initialStage);

    Scene splashScene = new Scene(splashLayout);
    initialStage.initStyle(StageStyle.UNDECORATED);
    final Rectangle2D bounds = Screen.getPrimary().getBounds();
    initialStage.setScene(splashScene);
    initialStage.setX(bounds.getMinX() + bounds.getWidth() / 2 - SPLASH_WIDTH / 2);
    initialStage.setY(bounds.getMinY() + bounds.getHeight() / 2 - SPLASH_HEIGHT / 2);
    initialStage.show();
}