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();
}
}
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();
}
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();
}
}
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();
}
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();
}
Aggregations