Search in sources :

Example 1 with FadeTransition

use of javafx.animation.FadeTransition in project JFoenix by jfoenixadmin.

the class JFXBadge method refreshBadge.

public void refreshBadge() {
    badge.getChildren().clear();
    if (enabled) {
        //			final double scaledWidth = control.getLayoutBounds().getWidth() / getBadgeScale().doubleValue();
        //			final double scaledHeight = control.getLayoutBounds().getHeight() / getBadgeScale().doubleValue();
        //			Shape background = new Rectangle(scaledWidth, scaledHeight);
        //			Shape clip = new Rectangle(scaledWidth, scaledHeight);
        //
        //			if (maskType.get().equals(JFXBadge.BadgeMask.CIRCLE)) {
        //				double radius = Math.min(scaledWidth / 2, scaledHeight / 2);
        //				background = new Circle(radius);
        //				clip = new Circle(radius);
        //			}
        //			
        //
        //			if (badgeFill.get() instanceof Color) {
        //				Color circleColor = new Color(((Color) badgeFill.get()).getRed(), ((Color) badgeFill.get()).getGreen(),
        //						((Color) badgeFill.get()).getBlue(), ((Color) badgeFill.get()).getOpacity());
        //				background.setStroke(circleColor);
        //				background.setFill(circleColor);
        //			} else {
        //				background.setStroke(badgeFill.get());
        //				background.setFill(badgeFill.get());
        //			}
        Label labelControl = new Label(text.getValue());
        StackPane badgePane = new StackPane();
        //			badgePane.getChildren().add(background);
        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();
    }
}
Also used : FadeTransition(javafx.animation.FadeTransition) Label(javafx.scene.control.Label) StackPane(javafx.scene.layout.StackPane)

Example 2 with FadeTransition

use of javafx.animation.FadeTransition in project Retrospector by NonlinearFruit.

the class Retrospector method showSplash.

private void showSplash(final Stage initStage, Task<?> task, InitCompletionHandler initCompletionHandler) {
    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);
            initStage.toFront();
            FadeTransition fadeSplash = new FadeTransition(Duration.seconds(1.2), splashLayout);
            fadeSplash.setFromValue(1.0);
            fadeSplash.setToValue(0.0);
            fadeSplash.setOnFinished(actionEvent -> initStage.hide());
            fadeSplash.play();
            initCompletionHandler.complete();
        }
    // todo add code to gracefully handle other task states.
    });
    Scene splashScene = new Scene(splashLayout, Color.TRANSPARENT);
    final Rectangle2D bounds = Screen.getPrimary().getBounds();
    initStage.setScene(splashScene);
    initStage.setX(bounds.getMinX() + bounds.getWidth() / 2 - SPLASH_WIDTH / 2);
    initStage.setY(bounds.getMinY() + bounds.getHeight() / 2 - SPLASH_HEIGHT / 2);
    initStage.setAlwaysOnTop(true);
    initStage.initStyle(StageStyle.TRANSPARENT);
    initStage.show();
}
Also used : FadeTransition(javafx.animation.FadeTransition) Rectangle2D(javafx.geometry.Rectangle2D) Scene(javafx.scene.Scene)

Example 3 with FadeTransition

use of javafx.animation.FadeTransition in project bitsquare by bitsquare.

the class VolumeChart method seriesRemoved.

@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);
        }
    }
}
Also used : FadeTransition(javafx.animation.FadeTransition) ActionEvent(javafx.event.ActionEvent) Node(javafx.scene.Node) XYChart(javafx.scene.chart.XYChart)

Example 4 with FadeTransition

use of javafx.animation.FadeTransition in project bitsquare by bitsquare.

the class VolumeChart method dataItemAdded.

@Override
protected void dataItemAdded(XYChart.Series<Number, Number> series, int itemIndex, XYChart.Data<Number, Number> item) {
    Node volumeBar = createCandle(getData().indexOf(series), item, itemIndex);
    if (getPlotChildren().contains(volumeBar))
        getPlotChildren().remove(volumeBar);
    if (shouldAnimate()) {
        volumeBar.setOpacity(0);
        getPlotChildren().add(volumeBar);
        FadeTransition ft = new FadeTransition(Duration.millis(500), volumeBar);
        ft.setToValue(1);
        ft.play();
    } else {
        getPlotChildren().add(volumeBar);
    }
}
Also used : FadeTransition(javafx.animation.FadeTransition) Node(javafx.scene.Node)

Example 5 with FadeTransition

use of javafx.animation.FadeTransition in project bitsquare by bitsquare.

the class CandleStickChart method seriesRemoved.

@Override
protected void seriesRemoved(XYChart.Series<Number, Number> series) {
    // remove all candle nodes
    for (XYChart.Data<Number, Number> d : series.getData()) {
        final Node candle = d.getNode();
        if (shouldAnimate()) {
            FadeTransition ft = new FadeTransition(Duration.millis(500), candle);
            ft.setToValue(0);
            ft.setOnFinished((ActionEvent actionEvent) -> {
                getPlotChildren().remove(candle);
            });
            ft.play();
        } else {
            getPlotChildren().remove(candle);
        }
    }
    if (series.getNode() instanceof Path) {
        Path seriesPath = (Path) series.getNode();
        if (shouldAnimate()) {
            FadeTransition ft = new FadeTransition(Duration.millis(500), seriesPath);
            ft.setToValue(0);
            ft.setOnFinished((ActionEvent actionEvent) -> {
                getPlotChildren().remove(seriesPath);
                seriesPath.getElements().clear();
            });
            ft.play();
        } else {
            getPlotChildren().remove(seriesPath);
            seriesPath.getElements().clear();
        }
    }
}
Also used : Path(javafx.scene.shape.Path) FadeTransition(javafx.animation.FadeTransition) ActionEvent(javafx.event.ActionEvent) Node(javafx.scene.Node) XYChart(javafx.scene.chart.XYChart)

Aggregations

FadeTransition (javafx.animation.FadeTransition)12 Node (javafx.scene.Node)8 ActionEvent (javafx.event.ActionEvent)4 XYChart (javafx.scene.chart.XYChart)4 Path (javafx.scene.shape.Path)4 Rectangle2D (javafx.geometry.Rectangle2D)1 Scene (javafx.scene.Scene)1 Label (javafx.scene.control.Label)1 StackPane (javafx.scene.layout.StackPane)1 Duration (javafx.util.Duration)1