Example usage for javafx.scene.transform Rotate X_AXIS

List of usage examples for javafx.scene.transform Rotate X_AXIS

Introduction

In this page you can find the example usage for javafx.scene.transform Rotate X_AXIS.

Prototype

Point3D X_AXIS

To view the source code for javafx.scene.transform Rotate X_AXIS.

Click Source Link

Document

Specifies the X-axis as the axis of rotation.

Usage

From source file:io.bitsquare.gui.main.overlays.Overlay.java

protected void animateHide(Runnable onFinishedHandler) {
    Interpolator interpolator = Interpolator.SPLINE(0.25, 0.1, 0.25, 1);
    double duration = getDuration(200);
    Timeline timeline = new Timeline();
    ObservableList<KeyFrame> keyFrames = timeline.getKeyFrames();

    if (type.animationType == AnimationType.SlideDownFromCenterTop) {
        double endY = -gridPane.getHeight();
        keyFrames//from  w w  w .  j  a  va  2 s.c  o  m
                .add(new KeyFrame(Duration.millis(0), new KeyValue(gridPane.opacityProperty(), 1, interpolator),
                        new KeyValue(gridPane.translateYProperty(), -10, interpolator)));
        keyFrames.add(new KeyFrame(Duration.millis(duration),
                new KeyValue(gridPane.opacityProperty(), 0, interpolator),
                new KeyValue(gridPane.translateYProperty(), endY, interpolator)));

        timeline.setOnFinished(e -> onFinishedHandler.run());
        timeline.play();
    } else if (type.animationType == AnimationType.ScaleFromCenter) {
        double endScale = 0.25;
        keyFrames
                .add(new KeyFrame(Duration.millis(0), new KeyValue(gridPane.opacityProperty(), 1, interpolator),
                        new KeyValue(gridPane.scaleXProperty(), 1, interpolator),
                        new KeyValue(gridPane.scaleYProperty(), 1, interpolator)));
        keyFrames.add(new KeyFrame(Duration.millis(duration),
                new KeyValue(gridPane.opacityProperty(), 0, interpolator),
                new KeyValue(gridPane.scaleXProperty(), endScale, interpolator),
                new KeyValue(gridPane.scaleYProperty(), endScale, interpolator)));
    } else if (type.animationType == AnimationType.ScaleYFromCenter) {
        gridPane.setRotationAxis(Rotate.X_AXIS);
        gridPane.getScene().setCamera(new PerspectiveCamera());
        keyFrames.add(new KeyFrame(Duration.millis(0), new KeyValue(gridPane.rotateProperty(), 0, interpolator),
                new KeyValue(gridPane.opacityProperty(), 1, interpolator)));
        keyFrames.add(new KeyFrame(Duration.millis(duration),
                new KeyValue(gridPane.rotateProperty(), -90, interpolator),
                new KeyValue(gridPane.opacityProperty(), 0, interpolator)));
    } else if (type.animationType == AnimationType.ScaleDownToCenter) {
        double endScale = 0.1;
        keyFrames
                .add(new KeyFrame(Duration.millis(0), new KeyValue(gridPane.opacityProperty(), 1, interpolator),
                        new KeyValue(gridPane.scaleXProperty(), 1, interpolator),
                        new KeyValue(gridPane.scaleYProperty(), 1, interpolator)));
        keyFrames.add(new KeyFrame(Duration.millis(duration),
                new KeyValue(gridPane.opacityProperty(), 0, interpolator),
                new KeyValue(gridPane.scaleXProperty(), endScale, interpolator),
                new KeyValue(gridPane.scaleYProperty(), endScale, interpolator)));
    } else if (type.animationType == AnimationType.FadeInAtCenter) {
        keyFrames.add(
                new KeyFrame(Duration.millis(0), new KeyValue(gridPane.opacityProperty(), 1, interpolator)));
        keyFrames.add(new KeyFrame(Duration.millis(duration),
                new KeyValue(gridPane.opacityProperty(), 0, interpolator)));
    }

    timeline.setOnFinished(e -> onFinishedHandler.run());
    timeline.play();
}