Java Code Examples for javafx.animation.Timeline#getKeyFrames()
The following examples show how to use
javafx.animation.Timeline#getKeyFrames() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DaoLaunchWindow.java From bisq with GNU Affero General Public License v3.0 | 6 votes |
private void createSlideAnimation(Timeline timeline, double imageWidth) { Interpolator interpolator = Interpolator.EASE_OUT; ObservableList<KeyFrame> keyFrames = timeline.getKeyFrames(); double endX = -imageWidth; keyFrames.add(new KeyFrame(Duration.millis(0), new KeyValue(sectionScreenshot.opacityProperty(), 1, interpolator), new KeyValue(sectionScreenshot.translateXProperty(), 0, interpolator))); keyFrames.add(new KeyFrame(Duration.millis(DURATION), event -> { sectionDescriptionLabel.setText(selectedSection.description); sectionScreenshot.setId(selectedSection.imageId); }, new KeyValue(sectionScreenshot.opacityProperty(), 0, interpolator), new KeyValue(sectionScreenshot.translateXProperty(), endX, interpolator))); double startX = imageWidth; keyFrames.add(new KeyFrame(Duration.millis(DURATION), new KeyValue(sectionScreenshot.opacityProperty(), 0, interpolator), new KeyValue(sectionScreenshot.translateXProperty(), startX, interpolator))); keyFrames.add(new KeyFrame(Duration.millis(DURATION * 2), new KeyValue(sectionScreenshot.opacityProperty(), 1, interpolator), new KeyValue(sectionScreenshot.translateXProperty(), 0, interpolator))); }
Example 2
Source File: PeerInfoWithTagEditor.java From bisq with GNU Affero General Public License v3.0 | 6 votes |
@Override protected void animateDisplay() { if (GlobalSettings.getUseAnimations()) { double startY = -160; double duration = getDuration(400); Interpolator interpolator = Interpolator.SPLINE(0.25, 0.1, 0.25, 1); Timeline timeline = new Timeline(); ObservableList<KeyFrame> keyFrames = timeline.getKeyFrames(); keyFrames.add(new KeyFrame(Duration.millis(0), new KeyValue(gridPane.opacityProperty(), 0, interpolator), new KeyValue(gridPane.translateYProperty(), startY, interpolator) )); keyFrames.add(new KeyFrame(Duration.millis(duration), new KeyValue(gridPane.opacityProperty(), 1, interpolator), new KeyValue(gridPane.translateYProperty(), 0, interpolator) )); timeline.play(); } }
Example 3
Source File: Notification.java From bisq with GNU Affero General Public License v3.0 | 5 votes |
@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(); } }
Example 4
Source File: Notification.java From bisq with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void animateDisplay() { if (NotificationCenter.useAnimations) { double startX = 320; double duration = getDuration(600); Interpolator interpolator = Interpolator.SPLINE(0.25, 0.1, 0.25, 1); Timeline timeline = new Timeline(); ObservableList<KeyFrame> keyFrames = timeline.getKeyFrames(); keyFrames.add(new KeyFrame(Duration.millis(0), new KeyValue(gridPane.opacityProperty(), 0, interpolator), new KeyValue(gridPane.translateXProperty(), startX, interpolator) )); //bouncing /* keyFrames.add(new KeyFrame(Duration.millis(duration * 0.6), new KeyValue(gridPane.opacityProperty(), 1, interpolator), new KeyValue(gridPane.translateXProperty(), -12, interpolator) )); keyFrames.add(new KeyFrame(Duration.millis(duration * 0.8), new KeyValue(gridPane.opacityProperty(), 1, interpolator), new KeyValue(gridPane.translateXProperty(), 4, interpolator) ));*/ keyFrames.add(new KeyFrame(Duration.millis(duration), new KeyValue(gridPane.opacityProperty(), 1, interpolator), new KeyValue(gridPane.translateXProperty(), 0, interpolator) )); timeline.play(); } }
Example 5
Source File: PeerInfoWithTagEditor.java From bisq with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void animateHide(Runnable onFinishedHandler) { if (GlobalSettings.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(); } }