javafx.animation.PauseTransition Java Examples
The following examples show how to use
javafx.animation.PauseTransition.
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: AdminAddUserViewController.java From Corendon-LostLuggage with MIT License | 6 votes |
public void startAnimation() { errorMessageView.prefHeight(0.0d); mainBorderPane.setTop(errorMessageView); errorMessageHBox.getChildren().add(errorMessageLbl); errorMessageLbl.setVisible(true); Timeline timeline = new Timeline(); timeline.getKeyFrames().addAll(new KeyFrame(Duration.ZERO, new KeyValue(errorMessageView.prefHeightProperty(), 0) ), new KeyFrame(Duration.millis(300.0d), new KeyValue(errorMessageView.prefHeightProperty(), navListPrefHeight) ) ); addUserBtn.setDisable(true); timeline.play(); PauseTransition wait = new PauseTransition(Duration.seconds(4)); wait.setOnFinished((e) -> { dismissAnimation(); }); wait.play(); }
Example #2
Source File: LiveDataFetcher.java From marathonv5 with Apache License 2.0 | 6 votes |
public void regionOrProductChanged() { cancel(); boolean regionChanged = updateRegionAndProductSelection(); if (regionChanged) { // pause the data updating to wait for animation to finish PauseTransition delay = new PauseTransition(Duration.millis(1500)); delay.setOnFinished(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent t) { restart(); } }); delay.play(); } else { restart(); } }
Example #3
Source File: LiveDataFetcher.java From marathonv5 with Apache License 2.0 | 6 votes |
public void regionOrProductChanged() { cancel(); boolean regionChanged = updateRegionAndProductSelection(); if (regionChanged) { // pause the data updating to wait for animation to finish PauseTransition delay = new PauseTransition(Duration.millis(1500)); delay.setOnFinished(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent t) { restart(); } }); delay.play(); } else { restart(); } }
Example #4
Source File: DisplayEditorApplication.java From phoebus with Eclipse Public License 1.0 | 6 votes |
@Override public DisplayEditorInstance create() { if (!AuthorizationService.hasAuthorization("edit_display")) { // User does not have a permission to start editor final Alert alert = new Alert(Alert.AlertType.WARNING); DialogHelper.positionDialog(alert, DockPane.getActiveDockPane(), -200, -100); alert.initOwner(DockPane.getActiveDockPane().getScene().getWindow()); alert.setResizable(true); alert.setTitle(DISPLAY_NAME); alert.setHeaderText(Messages.DisplayApplicationMissingRight); // Autohide in some seconds, also to handle the situation after // startup without edit_display rights but opening editor from memento PauseTransition wait = new PauseTransition(Duration.seconds(7)); wait.setOnFinished((e) -> { Button btn = (Button)alert.getDialogPane().lookupButton(ButtonType.OK); btn.fire(); }); wait.play(); alert.showAndWait(); return null; } return new DisplayEditorInstance(this); }
Example #5
Source File: SpaceFXView.java From SpaceFX with Apache License 2.0 | 6 votes |
public void storePlayer() { hallOfFame.add(new Player((digit1.getCharacter() + digit2.getCharacter()), score)); Collections.sort(hallOfFame); hallOfFame = hallOfFame.stream().limit(3).collect(Collectors.toList()); // Store hall of fame in properties properties.setProperty("hallOfFame1", hallOfFame.get(0).toPropertyString()); properties.setProperty("hallOfFame2", hallOfFame.get(1).toPropertyString()); properties.setProperty("hallOfFame3", hallOfFame.get(2).toPropertyString()); PropertyManager.INSTANCE.storeProperties(); HBox p1Entry = createHallOfFameEntry(new Player(properties.getProperty("hallOfFame1"))); HBox p2Entry = createHallOfFameEntry(new Player(properties.getProperty("hallOfFame2"))); HBox p3Entry = createHallOfFameEntry(new Player(properties.getProperty("hallOfFame3"))); hallOfFameBox.getChildren().setAll(p1Entry, p2Entry, p3Entry); hallOfFameBox.relocate((WIDTH - hallOfFameBox.getPrefWidth()) * 0.5, (HEIGHT - hallOfFameBox.getPrefHeight()) * 0.5); Helper.enableNode(playerInitialsLabel, false); Helper.enableNode(playerInitialsDigits, false); Helper.enableNode(saveInitialsButton, false); PauseTransition waitForHallOfFame = new PauseTransition(Duration.millis(3000)); waitForHallOfFame.setOnFinished(a -> reInitGame()); waitForHallOfFame.play(); }
Example #6
Source File: InfoPopup.java From charts with Apache License 2.0 | 6 votes |
private void init() { setAutoFix(true); rowCount = 2; fadeIn = new FadeTransition(Duration.millis(200), hBox); fadeIn.setFromValue(0); fadeIn.setToValue(0.75); fadeOut = new FadeTransition(Duration.millis(200), hBox); fadeOut.setFromValue(0.75); fadeOut.setToValue(0.0); fadeOut.setOnFinished(e -> hide()); delay = new PauseTransition(Duration.millis(_timeout)); delay.setOnFinished(e -> animatedHide()); }
Example #7
Source File: ParetoInfoPopup.java From charts with Apache License 2.0 | 6 votes |
private void init() { setAutoFix(true); rowCount = 2; fadeIn = new FadeTransition(Duration.millis(200), hBox); fadeIn.setFromValue(0); fadeIn.setToValue(0.75); fadeOut = new FadeTransition(Duration.millis(200), hBox); fadeOut.setFromValue(0.75); fadeOut.setToValue(0.0); fadeOut.setOnFinished(e -> hide()); delay = new PauseTransition(Duration.millis(_timeout)); delay.setOnFinished(e -> animatedHide()); }
Example #8
Source File: NotificationView.java From Maus with GNU General Public License v3.0 | 6 votes |
public static void openNotification(String text) { Stage stage = new Stage(); stage.setWidth(300); stage.setHeight(125); Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds(); NotificationView notificationView = new NotificationView(); stage.setScene(new Scene(notificationView.getNotificationView(), 300, 125)); stage.setResizable(false); stage.setAlwaysOnTop(true); stage.setX(primaryScreenBounds.getMinX() + primaryScreenBounds.getWidth() - 300); stage.setY(primaryScreenBounds.getMinY() + primaryScreenBounds.getHeight() - 125); stage.initStyle(StageStyle.UNDECORATED); notificationView.getNotificationText().setWrapText(true); notificationView.getNotificationText().setAlignment(Pos.CENTER); notificationView.getNotificationText().setPadding(new Insets(0, 5, 0, 20)); notificationView.getNotificationText().setText(text); stage.show(); PauseTransition delay = new PauseTransition(Duration.seconds(5)); delay.setOnFinished(event -> stage.close()); delay.play(); }
Example #9
Source File: NotificationView.java From Maus with GNU General Public License v3.0 | 6 votes |
public static void openNotification(ClientObject client) { Stage stage = new Stage(); stage.setWidth(300); stage.setHeight(125); Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds(); NotificationView notificationView = new NotificationView(); stage.setScene(new Scene(notificationView.getNotificationView(), 300, 125)); stage.setResizable(false); stage.setAlwaysOnTop(true); stage.setX(primaryScreenBounds.getMinX() + primaryScreenBounds.getWidth() - 300); stage.setY(primaryScreenBounds.getMinY() + primaryScreenBounds.getHeight() - 125); stage.initStyle(StageStyle.UNDECORATED); notificationView.getNotificationText().setWrapText(true); notificationView.getNotificationText().setAlignment(Pos.CENTER); notificationView.getNotificationText().setPadding(new Insets(0, 5, 0, 20)); notificationView.getNotificationText().setText("New Connection: " + client.getIP() + " (" + client.getNickName() + ")"); stage.show(); PauseTransition delay = new PauseTransition(Duration.seconds(5)); delay.setOnFinished(event -> stage.close()); delay.play(); }
Example #10
Source File: JFXNodeUtils.java From JFoenix with Apache License 2.0 | 5 votes |
public static <T> InvalidationListener addDelayedPropertyInvalidationListener(ObservableValue<T> property, Duration delayTime, Consumer<T> consumer) { Wrapper<T> eventWrapper = new Wrapper<>(); PauseTransition holdTimer = new PauseTransition(delayTime); holdTimer.setOnFinished(event -> consumer.accept(eventWrapper.content)); final InvalidationListener invalidationListener = observable -> { eventWrapper.content = property.getValue(); holdTimer.playFromStart(); }; property.addListener(invalidationListener); return invalidationListener; }
Example #11
Source File: GaugeSkin.java From Enzo with Apache License 2.0 | 5 votes |
private void fadeBackToInteractive() { FadeTransition fadeUnitOut = new FadeTransition(Duration.millis(425), unit); fadeUnitOut.setFromValue(1.0); fadeUnitOut.setToValue(0.0); FadeTransition fadeValueOut = new FadeTransition(Duration.millis(425), value); fadeValueOut.setFromValue(1.0); fadeValueOut.setToValue(0.0); PauseTransition pause = new PauseTransition(Duration.millis(50)); FadeTransition fadeUnitIn = new FadeTransition(Duration.millis(425), unit); fadeUnitIn.setFromValue(0.0); fadeUnitIn.setToValue(1.0); FadeTransition fadeValueIn = new FadeTransition(Duration.millis(425), value); fadeValueIn.setFromValue(0.0); fadeValueIn.setToValue(1.0); ParallelTransition parallelIn = new ParallelTransition(fadeUnitIn, fadeValueIn); ParallelTransition parallelOut = new ParallelTransition(fadeUnitOut, fadeValueOut); parallelOut.setOnFinished(event -> { unit.setText("Interactive"); value.setText(""); resizeText(); }); SequentialTransition sequence = new SequentialTransition(parallelOut, pause, parallelIn); sequence.play(); }
Example #12
Source File: JFXNodeUtils.java From JFoenix with Apache License 2.0 | 5 votes |
public static <T> InvalidationListener addDelayedPropertyInvalidationListener(ObservableValue<T> property, Duration delayTime, BiConsumer<T, InvalidationListener> consumer) { Wrapper<T> eventWrapper = new Wrapper<>(); PauseTransition holdTimer = new PauseTransition(delayTime); final InvalidationListener invalidationListener = observable -> { eventWrapper.content = property.getValue(); holdTimer.playFromStart(); }; holdTimer.setOnFinished(event -> consumer.accept(eventWrapper.content, invalidationListener)); property.addListener(invalidationListener); return invalidationListener; }
Example #13
Source File: JFXNodeUtils.java From JFoenix with Apache License 2.0 | 5 votes |
public static <T> InvalidationListener addDelayedPropertyInvalidationListener(ObservableValue<T> property, Duration delayTime, Consumer<T> justInTimeConsumer, Consumer<T> delayedConsumer) { Wrapper<T> eventWrapper = new Wrapper<>(); PauseTransition holdTimer = new PauseTransition(delayTime); holdTimer.setOnFinished(event -> delayedConsumer.accept(eventWrapper.content)); final InvalidationListener invalidationListener = observable -> { eventWrapper.content = property.getValue(); justInTimeConsumer.accept(eventWrapper.content); holdTimer.playFromStart(); }; property.addListener(invalidationListener); return invalidationListener; }
Example #14
Source File: JFXNodeUtils.java From JFoenix with Apache License 2.0 | 5 votes |
public static <T extends Event> EventHandler<? super T> addDelayedEventHandler(Node control, Duration delayTime, final EventType<T> eventType, final EventHandler<? super T> eventHandler) { Wrapper<T> eventWrapper = new Wrapper<>(); PauseTransition holdTimer = new PauseTransition(delayTime); holdTimer.setOnFinished(finish -> eventHandler.handle(eventWrapper.content)); final EventHandler<? super T> eventEventHandler = event -> { eventWrapper.content = event; holdTimer.playFromStart(); }; control.addEventHandler(eventType, eventEventHandler); return eventEventHandler; }
Example #15
Source File: DamageNumber.java From metastone with GNU General Public License v2.0 | 5 votes |
public DamageNumber(String text, GameToken parent, int successiveHits) { this.parent = parent; this.setAlignment(Pos.CENTER); ImageView image = new ImageView(IconFactory.getImageUrl("common/splash.png")); image.setFitWidth(96); image.setFitHeight(96); if (successiveHits > 0) { double xOffset = -48 * successiveHits; setTranslateX(xOffset); } Text textShape = new Text(text); textShape.setFill(Color.WHITE); textShape.setStyle("-fx-font-size: 22pt; -fx-font-family: \"System\";-fx-font-weight: 900;-fx-stroke: black;-fx-stroke-width: 2;"); setCache(true); setCacheHint(CacheHint.SPEED); getChildren().add(image); getChildren().add(textShape); parent.getAnchor().getChildren().add(this); NotificationProxy.sendNotification(GameNotification.ANIMATION_STARTED); PauseTransition animation = new PauseTransition(Duration.seconds(1.2)); animation.setOnFinished(this::onComplete); animation.play(); }
Example #16
Source File: HeatControlSkin.java From Enzo with Apache License 2.0 | 5 votes |
private void fadeBack() { FadeTransition fadeInfoTextOut = new FadeTransition(Duration.millis(425), infoText); fadeInfoTextOut.setFromValue(1.0); fadeInfoTextOut.setToValue(0.0); FadeTransition fadeValueOut = new FadeTransition(Duration.millis(425), value); fadeValueOut.setFromValue(1.0); fadeValueOut.setToValue(0.0); PauseTransition pause = new PauseTransition(Duration.millis(50)); FadeTransition fadeInfoTextIn = new FadeTransition(Duration.millis(425), infoText); fadeInfoTextIn.setFromValue(0.0); fadeInfoTextIn.setToValue(1.0); FadeTransition fadeValueIn = new FadeTransition(Duration.millis(425), value); fadeValueIn.setFromValue(0.0); fadeValueIn.setToValue(1.0); ParallelTransition parallelIn = new ParallelTransition(fadeInfoTextIn, fadeValueIn); ParallelTransition parallelOut = new ParallelTransition(fadeInfoTextOut, fadeValueOut); parallelOut.setOnFinished(event -> { double currentValue = (valueIndicatorRotate.getAngle() + getSkinnable().getStartAngle() - 180) / angleStep + getSkinnable().getMinValue(); value.setText(String.format(Locale.US, "%." + getSkinnable().getDecimals() + "f", currentValue)); value.setTranslateX((size - value.getLayoutBounds().getWidth()) * 0.5); if (getSkinnable().getTarget() < getSkinnable().getValue()) { getSkinnable().setInfoText("COOLING"); } else if (getSkinnable().getTarget() > getSkinnable().getValue()) { getSkinnable().setInfoText("HEATING"); } resizeText(); drawTickMarks(ticks); userAction = false; }); SequentialTransition sequence = new SequentialTransition(parallelOut, pause, parallelIn); sequence.play(); }
Example #17
Source File: RadialBargraphSkin.java From Enzo with Apache License 2.0 | 5 votes |
private void fadeBackToInteractive() { FadeTransition fadeUnitOut = new FadeTransition(Duration.millis(425), unit); fadeUnitOut.setFromValue(1.0); fadeUnitOut.setToValue(0.0); FadeTransition fadeValueOut = new FadeTransition(Duration.millis(425), value); fadeValueOut.setFromValue(1.0); fadeValueOut.setToValue(0.0); PauseTransition pause = new PauseTransition(Duration.millis(50)); FadeTransition fadeUnitIn = new FadeTransition(Duration.millis(425), unit); fadeUnitIn.setFromValue(0.0); fadeUnitIn.setToValue(1.0); FadeTransition fadeValueIn = new FadeTransition(Duration.millis(425), value); fadeValueIn.setFromValue(0.0); fadeValueIn.setToValue(1.0); ParallelTransition parallelIn = new ParallelTransition(fadeUnitIn, fadeValueIn); ParallelTransition parallelOut = new ParallelTransition(fadeUnitOut, fadeValueOut); parallelOut.setOnFinished(event -> { unit.setText("Interactive"); value.setText(""); resizeText(); }); SequentialTransition sequence = new SequentialTransition(parallelOut, pause, parallelIn); sequence.play(); }
Example #18
Source File: JFXNodeUtils.java From JFoenix with Apache License 2.0 | 5 votes |
public static void addPressAndHoldFilter(Node node, Duration holdTime, EventHandler<MouseEvent> handler) { Wrapper<MouseEvent> eventWrapper = new Wrapper<>(); PauseTransition holdTimer = new PauseTransition(holdTime); holdTimer.setOnFinished(event -> handler.handle(eventWrapper.content)); node.addEventFilter(MouseEvent.MOUSE_PRESSED, event -> { eventWrapper.content = event; holdTimer.playFromStart(); }); node.addEventFilter(MouseEvent.MOUSE_RELEASED, event -> holdTimer.stop()); node.addEventFilter(MouseEvent.DRAG_DETECTED, event -> holdTimer.stop()); }
Example #19
Source File: JFXNodeUtils.java From JFoenix with Apache License 2.0 | 5 votes |
public static void addPressAndHoldHandler(Node node, Duration holdTime, EventHandler<MouseEvent> handler) { Wrapper<MouseEvent> eventWrapper = new Wrapper<>(); PauseTransition holdTimer = new PauseTransition(holdTime); holdTimer.setOnFinished(event -> handler.handle(eventWrapper.content)); node.addEventHandler(MouseEvent.MOUSE_PRESSED, event -> { eventWrapper.content = event; holdTimer.playFromStart(); }); node.addEventHandler(MouseEvent.MOUSE_RELEASED, event -> holdTimer.stop()); node.addEventHandler(MouseEvent.DRAG_DETECTED, event -> holdTimer.stop()); }
Example #20
Source File: MapPresenter.java From gluon-samples with BSD 3-Clause "New" or "Revised" License | 5 votes |
public void addPoint(MapPoint p, Node icon) { points.add(new Pair(p, icon)); icon.setVisible(false); this.getChildren().add(icon); // required to layout first the node and be able to find its // bounds PauseTransition pause = new PauseTransition(Duration.millis(100)); pause.setOnFinished(f -> { markDirty(); icon.setVisible(true); }); pause.play(); }
Example #21
Source File: MnistImageView.java From gluon-samples with BSD 3-Clause "New" or "Revised" License | 5 votes |
private void zoomIn() { PauseTransition p = new PauseTransition(Duration.millis(30)); p.setOnFinished(e -> { double factor = Math.max(INNER_WIDTH / this.getViewport().getWidth(), INNER_HEIGHT / this.getViewport().getHeight()); zoom(factor, this.getFitWidth()/2, this.getFitHeight()/2); translateViewport(-(IMAGE_WIDTH - this.getViewport().getWidth()) / 2, -(IMAGE_HEIGHT - this.getViewport().getHeight()) / 2); }); p.play(); }
Example #22
Source File: ScrollGesture.java From gef with Eclipse Public License 2.0 | 5 votes |
/** * (Re-)Starts playing the finish-delay-transition. * * @param viewer * The {@link IViewer} */ protected void playFinishDelayTransition(IViewer viewer) { if (!finishDelayTransitions.containsKey(viewer)) { finishDelayTransitions.put(viewer, createFinishDelayTransition(viewer)); } PauseTransition pauseTransition = finishDelayTransitions.get(viewer); pauseTransition.stop(); pauseTransition.setDuration(Duration.millis(getFinishDelayMillis())); pauseTransition.playFromStart(); }
Example #23
Source File: ScrollGesture.java From gef with Eclipse Public License 2.0 | 5 votes |
/** * * @param viewer * The {@link IViewer} * @return A {@link PauseTransition} */ protected PauseTransition createFinishDelayTransition( final IViewer viewer) { PauseTransition pauseTransition = new PauseTransition( Duration.millis(getFinishDelayMillis())); pauseTransition.setOnFinished((ae) -> { scrollFinished(viewer); inScroll.remove(viewer); }); return pauseTransition; }
Example #24
Source File: InfoPopup.java From charts with Apache License 2.0 | 5 votes |
private void init() { setAutoFix(true); fadeIn = new FadeTransition(Duration.millis(200), hBox); fadeIn.setFromValue(0); fadeIn.setToValue(0.75); fadeOut = new FadeTransition(Duration.millis(200), hBox); fadeOut.setFromValue(0.75); fadeOut.setToValue(0.0); fadeOut.setOnFinished(e -> hide()); delay = new PauseTransition(Duration.millis(_timeout)); delay.setOnFinished(e -> animatedHide()); }
Example #25
Source File: Splash.java From phoebus with Eclipse Public License 1.0 | 5 votes |
/** Close the splash screen */ public void close() { // Keep the splash for another 3 seconds // (so in case of fast startup it's at least shown 3 secs), // then fade out. final PauseTransition pause = new PauseTransition(Duration.seconds(3)); final FadeTransition fade = new FadeTransition(Duration.seconds(1.5), stage.getScene().getRoot()); fade.setFromValue(1.0); fade.setToValue(0); final SequentialTransition animation = new SequentialTransition(pause, fade); animation.setOnFinished(event -> stage.close()); animation.play(); }
Example #26
Source File: AppViewManager.java From Game2048FX with GNU General Public License v3.0 | 4 votes |
public static void registerViews(MobileApplication app) { NavigationDrawer drawer = app.getDrawer(); for (AppView view : REGISTRY.getViews()) { view.registerView(app); if (view.isShownInDrawer()) { drawer.getItems().add(view.getMenuItem()); } } cloud = Injector.instantiateModelOrService(Cloud.class); cloud.authenticatedUserProperty().addListener(o -> drawer.setHeader(getHeader())); drawer.setHeader(getHeader()); final NavigationDrawer.Item aboutItem = new NavigationDrawer.Item("About 2048FX", MaterialDesignIcon.INFO_OUTLINE.graphic()); drawer.selectedItemProperty().addListener((obs, ov, nv) -> { if (aboutItem.equals(nv)) { PauseTransition pause = new PauseTransition(Duration.seconds(0.5)); pause.setOnFinished(f -> new About()); pause.play(); drawer.setSelectedItem(GAME_VIEW.getMenuItem()); } }); drawer.getItems().add(aboutItem); if (Platform.isDesktop()) { NavigationDrawer.Item quitItem = new NavigationDrawer.Item("Quit", MaterialDesignIcon.EXIT_TO_APP.graphic()); quitItem.selectedProperty().addListener((obs, ov, nv) -> { if (nv) { Services.get(LifecycleService.class).ifPresent(LifecycleService::shutdown); } }); drawer.getItems().add(quitItem); } drawer.skinProperty().addListener(new InvalidationListener() { @Override public void invalidated(Observable observable) { ListTile versionTile = new ListTile(); versionTile.setPrimaryGraphic(new ImageView()); versionTile.textProperty().addAll("2048FX", "Version " + VERSION + " - " + Year.now().toString()); HBox hBottom = new HBox(versionTile); hBottom.getStyleClass().add("drawer-bottom"); HBox.setHgrow(versionTile, Priority.ALWAYS); ((BorderPane) drawer.getChildrenUnmodifiable().get(0)).setBottom(hBottom); drawer.skinProperty().removeListener(this); } }); }
Example #27
Source File: SearchBoxBehavior.java From phoenicis with GNU Lesser General Public License v3.0 | 2 votes |
/** * Constructor * * @param control The control of the search box behavior * @param skin The skin of the search box behavior */ public SearchBoxBehavior(SearchBox control, SearchBoxSkin skin) { super(control, skin); this.pause = new PauseTransition(); }