List of usage examples for javafx.scene Node setOpacity
public final void setOpacity(double value)
From source file:com.github.vatbub.tictactoe.view.Main.java
private void fadeNode(Node node, double toValue, boolean block, Runnable onFinish) { guiAnimationQueue.submit(() -> {/*from ww w. j a v a 2 s .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(); }); }