List of usage examples for javafx.animation FadeTransition setNode
public final void setNode(Node value)
From source file:net.rptools.tokentool.controller.TokenTool_Controller.java
private void treeViewFinish() { log.info("***treeViewFinish called"); // Sort the nodes off of root treeItems = sortTreeNodes(treeItems); updateOverlayTreeview(treeItems);/* ww w. j a v a 2 s .c om*/ addPseudoClassToLeafs(overlayTreeView); updateOverlayTreeViewRecentFolder(false); // overlayNameLabel.setVisible(true); overlayTreeProgressBar.setStyle("-fx-accent: forestgreen;"); progressBarLabel.setVisible(false); FadeTransition fadeOut = new FadeTransition(Duration.millis(2000)); fadeOut.setNode(overlayTreeProgressBar); fadeOut.setFromValue(1.0); fadeOut.setToValue(0.0); fadeOut.setCycleCount(1); fadeOut.setAutoReverse(false); fadeOut.playFromStart(); FadeTransition fadeIn = new FadeTransition(Duration.millis(4000)); fadeIn.setNode(overlayNameLabel); fadeIn.setFromValue(0.0); fadeIn.setToValue(1.0); fadeIn.setCycleCount(1); fadeIn.setAutoReverse(false); fadeIn.playFromStart(); }
From source file:com.github.vatbub.tictactoe.view.Main.java
private void fadeNode(Node node, double toValue, boolean block, Runnable onFinish) { guiAnimationQueue.submit(() -> {//w w w. j av a2s .c o m if (block) { guiAnimationQueue.setBlocked(true); } if (!node.isVisible()) { node.setOpacity(0); node.setVisible(true); } FadeTransition fadeTransition = new FadeTransition(); fadeTransition.setNode(node); fadeTransition.setFromValue(node.getOpacity()); fadeTransition.setToValue(toValue); fadeTransition.setDuration(Duration.seconds(animationSpeed)); fadeTransition.setAutoReverse(false); fadeTransition.setOnFinished((event) -> { if (toValue == 0) { node.setEffect(null); node.setVisible(false); } if (block) { guiAnimationQueue.setBlocked(false); } if (onFinish != null) { onFinish.run(); } }); fadeTransition.play(); }); }
From source file:com.github.vatbub.tictactoe.view.Main.java
private void showLooser(Board.WinnerInfo winnerInfo) { String looserName = board.getOpponent(winnerInfo.winningPlayer).getName(); guiAnimationQueue.submitWaitForUnlock(() -> { ShakeTransition anim = new ShakeTransition(gamePane, null); anim.playFromStart();/*from w ww .j a v a 2 s. co m*/ Timeline timeline = new Timeline(); Circle c1 = new Circle((452 / 600.0) * looserPane.getWidth(), (323 / 640.0) * looserPane.getHeight(), 0); GaussianBlur circleBlur = new GaussianBlur(30); c1.setEffect(circleBlur); looseImage.setClip(c1); addWinLineOnLoose(winnerInfo); KeyValue keyValue1 = new KeyValue(c1.radiusProperty(), 0); KeyFrame keyFrame1 = new KeyFrame(Duration.millis(800), keyValue1); KeyValue keyValue2 = new KeyValue(c1.radiusProperty(), (500 / 640.0) * looserPane.getHeight()); KeyFrame keyFrame2 = new KeyFrame(Duration.millis(900), keyValue2); timeline.getKeyFrames().addAll(keyFrame1, keyFrame2); looseMessage.setOpacity(0); looserText.setText(looserName + " lost :("); looserPane.setVisible(true); looserPane.setOpacity(1); timeline.setOnFinished((event) -> { looseImage.setClip(null); winLineGroup.setClip(null); blurGamePane(); PauseTransition wait = new PauseTransition(); wait.setDuration(Duration.seconds(1)); wait.setOnFinished((event2) -> { FadeTransition looseMessageTransition = new FadeTransition(); looseMessageTransition.setNode(looseMessage); looseMessageTransition.setFromValue(0); looseMessageTransition.setToValue(1); looseMessageTransition.setDuration(Duration.millis(500)); looseMessageTransition.setAutoReverse(false); looseMessageTransition.play(); }); wait.play(); }); timeline.play(); }); }