Search in sources :

Example 6 with FadeTransition

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

the class VolumeChart method seriesAdded.

@Override
protected void seriesAdded(XYChart.Series<Number, Number> series, int seriesIndex) {
    for (int j = 0; j < series.getData().size(); j++) {
        XYChart.Data item = series.getData().get(j);
        Node volumeBar = createCandle(seriesIndex, item, j);
        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) XYChart(javafx.scene.chart.XYChart)

Example 7 with FadeTransition

use of javafx.animation.FadeTransition in project sakuli by ConSol.

the class ProfileController method animateMessage.

private void animateMessage() {
    FadeTransition ft = new FadeTransition(Duration.millis(1000), success);
    ft.setFromValue(0.0);
    ft.setToValue(1);
    ft.play();
}
Also used : FadeTransition(javafx.animation.FadeTransition)

Example 8 with FadeTransition

use of javafx.animation.FadeTransition in project SmartCity-Market by TechnionYP5777.

the class AbstractApplicationScreen method fadeTransition.

public static void fadeTransition(Node n) {
    FadeTransition x = new FadeTransition(new Duration(2000), n);
    x.setFromValue(0);
    x.setToValue(100);
    x.setCycleCount(1);
    x.setInterpolator(Interpolator.LINEAR);
    x.play();
}
Also used : FadeTransition(javafx.animation.FadeTransition) Duration(javafx.util.Duration)

Example 9 with FadeTransition

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

the class CandleStickChart method dataItemAdded.

@Override
protected void dataItemAdded(XYChart.Series<Number, Number> series, int itemIndex, XYChart.Data<Number, Number> item) {
    Node candle = createCandle(getData().indexOf(series), item, itemIndex);
    if (getPlotChildren().contains(candle))
        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);
    }
    if (series.getNode() instanceof Path) {
        Path seriesPath = (Path) series.getNode();
        seriesPath.toFront();
    }
}
Also used : Path(javafx.scene.shape.Path) FadeTransition(javafx.animation.FadeTransition) Node(javafx.scene.Node)

Example 10 with FadeTransition

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

the class CandleStickChart method dataItemRemoved.

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

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