Search in sources :

Example 26 with PerspectiveCamera

use of javafx.scene.PerspectiveCamera in project bitsquare by bitsquare.

the class PeerInfoWithTagEditor method animateHide.

@Override
protected void animateHide(Runnable onFinishedHandler) {
    if (Preferences.INSTANCE.getUseAnimations()) {
        double duration = getDuration(300);
        Interpolator interpolator = Interpolator.SPLINE(0.25, 0.1, 0.25, 1);
        gridPane.setRotationAxis(Rotate.X_AXIS);
        Camera camera = gridPane.getScene().getCamera();
        gridPane.getScene().setCamera(new PerspectiveCamera());
        Timeline timeline = new Timeline();
        ObservableList<KeyFrame> keyFrames = timeline.getKeyFrames();
        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)));
        timeline.setOnFinished(event -> {
            gridPane.setRotate(0);
            gridPane.setRotationAxis(Rotate.Z_AXIS);
            gridPane.getScene().setCamera(camera);
            onFinishedHandler.run();
        });
        timeline.play();
    } else {
        onFinishedHandler.run();
    }
}
Also used : Timeline(javafx.animation.Timeline) KeyValue(javafx.animation.KeyValue) KeyFrame(javafx.animation.KeyFrame) Interpolator(javafx.animation.Interpolator) PerspectiveCamera(javafx.scene.PerspectiveCamera) Camera(javafx.scene.Camera) PerspectiveCamera(javafx.scene.PerspectiveCamera)

Example 27 with PerspectiveCamera

use of javafx.scene.PerspectiveCamera in project bisq-desktop by bisq-network.

the class Overlay method animateHide.

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.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();
}
Also used : Timeline(javafx.animation.Timeline) KeyValue(javafx.animation.KeyValue) KeyFrame(javafx.animation.KeyFrame) Interpolator(javafx.animation.Interpolator) PerspectiveCamera(javafx.scene.PerspectiveCamera)

Example 28 with PerspectiveCamera

use of javafx.scene.PerspectiveCamera in project bisq-desktop by bisq-network.

the class Notification method animateHide.

@Override
protected void animateHide(Runnable onFinishedHandler) {
    if (autoCloseTimer != null) {
        autoCloseTimer.stop();
        autoCloseTimer = null;
    }
    if (NotificationCenter.useAnimations) {
        double duration = getDuration(400);
        Interpolator interpolator = Interpolator.SPLINE(0.25, 0.1, 0.25, 1);
        gridPane.setRotationAxis(Rotate.X_AXIS);
        Camera camera = gridPane.getScene().getCamera();
        gridPane.getScene().setCamera(new PerspectiveCamera());
        Timeline timeline = new Timeline();
        ObservableList<KeyFrame> keyFrames = timeline.getKeyFrames();
        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)));
        timeline.setOnFinished(event -> {
            gridPane.setRotate(0);
            gridPane.setRotationAxis(Rotate.Z_AXIS);
            gridPane.getScene().setCamera(camera);
            onFinishedHandler.run();
        });
        timeline.play();
    } else {
        onFinishedHandler.run();
    }
}
Also used : Timeline(javafx.animation.Timeline) KeyValue(javafx.animation.KeyValue) KeyFrame(javafx.animation.KeyFrame) Interpolator(javafx.animation.Interpolator) Camera(javafx.scene.Camera) PerspectiveCamera(javafx.scene.PerspectiveCamera) PerspectiveCamera(javafx.scene.PerspectiveCamera)

Example 29 with PerspectiveCamera

use of javafx.scene.PerspectiveCamera in project Board-Instrumentation-Framework by intel.

the class Demo method start.

@Override
public void start(Stage stage) {
    BorderPane pane = new BorderPane(flipPanel);
    pane.setPrefSize(400, 250);
    pane.setPadding(new Insets(50, 50, 50, 50));
    pane.setBackground(new Background(new BackgroundFill(Color.rgb(68, 68, 68), CornerRadii.EMPTY, Insets.EMPTY)));
    PerspectiveCamera camera = new PerspectiveCamera(false);
    camera.setFieldOfView(20);
    Scene scene = new Scene(pane);
    scene.setCamera(camera);
    scene.getStylesheets().add(Demo.class.getResource("styles.css").toExternalForm());
    stage.setTitle("FlipPanel Demo");
    stage.setScene(scene);
    stage.show();
}
Also used : BorderPane(javafx.scene.layout.BorderPane) Insets(javafx.geometry.Insets) Background(javafx.scene.layout.Background) BackgroundFill(javafx.scene.layout.BackgroundFill) PerspectiveCamera(javafx.scene.PerspectiveCamera) Scene(javafx.scene.Scene)

Example 30 with PerspectiveCamera

use of javafx.scene.PerspectiveCamera in project Board-Instrumentation-Framework by intel.

the class FlipClock method start.

@Override
public void start(Stage stage) {
    // Create the red flaps for the seconds
    SplitFlapImgFactory.INSTANCE.setFlapColor(Color.web("#FF1200"));
    secLeft.setBackgroundImage(SplitFlapImgFactory.INSTANCE.createBackgroundImage(234, 402));
    secLeft.setFlapImage(SplitFlapImgFactory.INSTANCE.createFlapImage(234, 402));
    secRight.setBackgroundImage(SplitFlapImgFactory.INSTANCE.createBackgroundImage(234, 402));
    secRight.setFlapImage(SplitFlapImgFactory.INSTANCE.createFlapImage(234, 402));
    HBox dayBox = new HBox();
    dayBox.setSpacing(0);
    dayBox.getChildren().addAll(dayLeft, dayMid, dayRight);
    dayBox.setLayoutX(12);
    dayBox.setLayoutY(76);
    HBox dateBox = new HBox();
    dateBox.setSpacing(0);
    dateBox.getChildren().addAll(dateLeft, dateRight);
    dateBox.setLayoutX(495);
    dateBox.setLayoutY(76);
    HBox monthBox = new HBox();
    monthBox.setSpacing(0);
    monthBox.getChildren().addAll(monthLeft, monthMid, monthRight);
    monthBox.setLayoutX(833);
    monthBox.setLayoutY(76);
    HBox clockBox = new HBox();
    clockBox.setSpacing(0);
    HBox.setMargin(hourRight, new Insets(0, 40, 0, 0));
    HBox.setMargin(minRight, new Insets(0, 40, 0, 0));
    clockBox.getChildren().addAll(hourLeft, hourRight, minLeft, minRight, secLeft, secRight);
    clockBox.setLayoutY(375);
    Pane pane = new Pane(dayBox, dateBox, monthBox, clockBox);
    pane.setPadding(new Insets(10, 10, 10, 10));
    Scene scene = new Scene(pane, 1280, 800, new LinearGradient(0, 0, 0, 800, false, CycleMethod.NO_CYCLE, new Stop(0.0, Color.rgb(28, 27, 22)), new Stop(0.25, Color.rgb(38, 37, 32)), new Stop(1.0, Color.rgb(28, 27, 22))));
    scene.setCamera(new PerspectiveCamera());
    stage.setScene(scene);
    stage.show();
    timer.start();
}
Also used : LinearGradient(javafx.scene.paint.LinearGradient) HBox(javafx.scene.layout.HBox) Insets(javafx.geometry.Insets) Stop(javafx.scene.paint.Stop) PerspectiveCamera(javafx.scene.PerspectiveCamera) Scene(javafx.scene.Scene) Pane(javafx.scene.layout.Pane)

Aggregations

PerspectiveCamera (javafx.scene.PerspectiveCamera)51 Scene (javafx.scene.Scene)36 Group (javafx.scene.Group)31 KeyCode (javafx.scene.input.KeyCode)31 PointLight (javafx.scene.PointLight)28 Rotate (javafx.scene.transform.Rotate)25 MouseEvent (javafx.scene.input.MouseEvent)23 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)16 AnimationTimer (javafx.animation.AnimationTimer)14 KeyFrame (javafx.animation.KeyFrame)12 KeyValue (javafx.animation.KeyValue)12 Timeline (javafx.animation.Timeline)12 Point3D (org.fxyz.geometry.Point3D)11 AmbientLight (javafx.scene.AmbientLight)10 Translate (javafx.scene.transform.Translate)10 Color (javafx.scene.paint.Color)9 ArrayList (java.util.ArrayList)8 Interpolator (javafx.animation.Interpolator)7 OBJWriter (org.fxyz.utils.OBJWriter)7 PhongMaterial (javafx.scene.paint.PhongMaterial)6