public FadeTransitionSample() { super(100,100); Rectangle rect = new Rectangle(0, 0, 100, 100); rect.setArcHeight(20); rect.setArcWidth(20); rect.setFill(Color.DODGERBLUE); getChildren().add(rect); fadeTransition = FadeTransitionBuilder.create() .duration(Duration.seconds(4)) .node(rect) .fromValue(1) .toValue(0.2) .cycleCount(Timeline.INDEFINITE) .autoReverse(true) .build(); }
public void show() { if (!showing) { World.getInstance().pause(); if (fadeOut != null && fadeOut.getStatus() != Animation.Status.STOPPED) { fadeOut.stop(); } fadeIn = FadeTransitionBuilder.create() .node(this) .toValue(1) .duration(Duration.seconds(1 - getOpacity())) .build(); fadeIn.play(); showing = true; } }
public void hide() { if (showing) { World.getInstance().play(); if (fadeIn != null && fadeIn.getStatus() != Animation.Status.STOPPED) { fadeIn.stop(); } fadeOut = FadeTransitionBuilder.create() .node(this) .toValue(0) .duration(Duration.seconds(getOpacity())) .build(); fadeOut.play(); showing = false; } }
/** * {@inheritDoc} */ @Override public void start() { SequentialTransitionBuilder.create() .children( buildBeanAnimation(this.ratioLabel, this.ratioCircle, MTColors.RESULT_RATIO.get()), buildBeanAnimation(this.timeLabel, this.timeBean, MTColors.RESULT_TIME.get()), ParallelTransitionBuilder.create() .children( TranslateTransitionBuilder.create().node(this.monsterImage).delay(Duration.millis(500)).duration(Duration.millis(400)) .byY(-766).build(), buildBeanAnimation(this.successLabel, this.successBean, MTColors.RESULT_SUCCESS.get()), FadeTransitionBuilder.create().node(this.successIcon).duration(Duration.millis(500)).fromValue(0).toValue(1).build()) .build(), ParallelTransitionBuilder.create() .children( buildBeanAnimation(this.failureLabel, this.failureBean, MTColors.RESULT_FAILURE.get()), FadeTransitionBuilder.create().node(this.failureIcon).duration(Duration.millis(500)).fromValue(0).toValue(1).build()) .build() ) .build().playFromStart(); }
RadialSettingsMenuCenter() { getChildren().add(hideTransitionGroup); getChildren().add(showTransitionGroup); showTransition = FadeTransitionBuilder.create() .duration(Duration.millis(400)).node(showTransitionGroup) .fromValue(0.0).toValue(1.0).build(); hideTransition = FadeTransitionBuilder.create() .duration(Duration.millis(400)).node(hideTransitionGroup) .fromValue(1.0).toValue(0.0).build(); }
private Transition createOpacityTransition(final Node node, final double from, final double to) { final FadeTransition fadeIn = FadeTransitionBuilder.create().node(node) .fromValue(from).toValue(to).duration(Duration.millis(200)) .build(); backContainer.setOpacity(from); return fadeIn; }
/** * Activate dock feedback on screen's bounds * * @param x * @param y */ public void setDockFeedbackVisible(double x, double y, double width, double height) { dockFeedback.setVisible(true); dockFeedback.setLayoutX(x); dockFeedback.setLayoutY(y); dockFeedback.setWidth(width); dockFeedback.setHeight(height); FadeTransition fadeTransition = FadeTransitionBuilder.create() .duration(Duration.millis(100)) .node(dockFeedback) .fromValue(0) .toValue(1) .autoReverse(true) .cycleCount(4) .build(); ScaleTransition scaleTransition = ScaleTransitionBuilder.create() .duration(Duration.millis(400)) .node(dockFeedback) .fromX(0.4) .fromY(0.4) .toX(1) .toY(1) .build(); parallelTransition = new ParallelTransition(dockFeedback); parallelTransition.getChildren().addAll(fadeTransition, scaleTransition); parallelTransition.setOnFinished(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent t) { dockFeedback.setVisible(false); } }); parallelTransition.play(); }
/** * TODO To complete. */ protected Animation buildFade(Node node) { return FadeTransitionBuilder.create().duration(Duration.millis(1000)).fromValue(0.0).toValue(1.0).node(node).build(); }