Java Code Examples for javafx.animation.FadeTransition#setToValue()

The following examples show how to use javafx.animation.FadeTransition#setToValue() . 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: Resumen.java    From uip-pc2 with MIT License 6 votes vote down vote up
public void transferir(ActionEvent actionEvent) {
    Stage stage = (Stage) movimientos.getScene().getWindow();
    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("Transferencia.fxml"));
    Parent root = null;
    try {
        root = fxmlLoader.load();
    } catch (Exception e) {
        Alert alerta = new Alert(Alert.AlertType.ERROR);
        alerta.setTitle("Error de Aplicación");
        alerta.setContentText("Llama al lapecillo de sistemas.");
        alerta.showAndWait();
        Platform.exit();
    }
    FadeTransition ft = new FadeTransition(Duration.millis(1500), root);
    ft.setFromValue(0.0);
    ft.setToValue(1.0);
    ft.play();
    Transferencia controller = fxmlLoader.<Transferencia>getController();
    controller.cargar_datos(cuenta.getText()); // ¯\_(ツ)_/¯ cuenta viene de la linea 27
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();
}
 
Example 2
Source File: CardPlayedToken.java    From metastone with GNU General Public License v2.0 6 votes vote down vote up
public CardPlayedToken(GameBoardView boardView, Card card) {
	Window parent = boardView.getScene().getWindow();
	this.cardToken = new CardTooltip();

	popup = new Popup();
	popup.getContent().setAll(cardToken);
	popup.setX(parent.getX() + 40);
	popup.show(parent);
	popup.setY(parent.getY() + parent.getHeight() * 0.5 - cardToken.getHeight() * 0.5);

	cardToken.setCard(card);

	NotificationProxy.sendNotification(GameNotification.ANIMATION_STARTED);
	FadeTransition animation = new FadeTransition(Duration.seconds(1.2), cardToken);
	animation.setDelay(Duration.seconds(0.6f));
	animation.setOnFinished(this::onComplete);
	animation.setFromValue(1);
	animation.setToValue(0);
	animation.play();
}
 
Example 3
Source File: AdvCandleStickChartSample.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
@Override protected void seriesAdded(Series<Number, Number> series, int seriesIndex) {
    // handle any data already in series
    for (int j = 0; j < series.getData().size(); j++) {
        Data item = series.getData().get(j);
        Node candle = createCandle(seriesIndex, item, j);
        if (shouldAnimate()) {
            candle.setOpacity(0);
            getPlotChildren().add(candle);
            // fade in new candle
            FadeTransition ft = new FadeTransition(Duration.millis(500), candle);
            ft.setToValue(1);
            ft.play();
        } else {
            getPlotChildren().add(candle);
        }
    }
    // create series path
    Path seriesPath = new Path();
    seriesPath.getStyleClass().setAll("candlestick-average-line", "series" + seriesIndex);
    series.setNode(seriesPath);
    getPlotChildren().add(seriesPath);
}
 
Example 4
Source File: PopOver.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Hides the pop over by quickly changing its opacity to 0.
 *
 * @param fadeOutDuration
 *            the duration of the fade transition that is being used to
 *            change the opacity of the pop over
 * @since 1.0
 */
public final void hide(Duration fadeOutDuration) {
    if (fadeOutDuration == null) {
        fadeOutDuration = DEFAULT_FADE_DURATION;
    }

    if (isShowing()) {
        // Fade Out
        Node skinNode = getSkin().getNode();
        skinNode.setOpacity(0);

        FadeTransition fadeOut = new FadeTransition(fadeOutDuration,
                skinNode);
        fadeOut.setFromValue(1);
        fadeOut.setToValue(0);
        fadeOut.setOnFinished(evt -> super.hide());
        fadeOut.play();
    }
}
 
Example 5
Source File: ContentPane.java    From pdfsam with GNU Affero General Public License v3.0 6 votes vote down vote up
@Inject
public ContentPane(WorkArea modules, Dashboard dashboard, NewsPanel news,
        @Named("defaultDashboardItemId") String defaultDasboardItem) {
    this.modules = modules;
    this.dashboard = dashboard;
    this.newsContainer = new VBox(news);
    this.newsContainer.getStyleClass().add("news-container");
    StackPane stack = new StackPane(modules, dashboard);
    setHgrow(stack, Priority.ALWAYS);
    newsContainer.managedProperty().bind(newsContainer.visibleProperty());
    newsContainer.setVisible(false);
    fadeIn = new FadeTransition(new Duration(300), newsContainer);
    fadeIn.setFromValue(0);
    fadeIn.setToValue(1);
    fadeOut = new FadeTransition(new Duration(300), newsContainer);
    fadeOut.setFromValue(1);
    fadeOut.setToValue(0);
    fadeOut.setOnFinished(e -> {
        newsContainer.setVisible(false);
    });
    getChildren().addAll(stack, newsContainer);
    eventStudio().addAnnotatedListeners(this);
    eventStudio().broadcast(new SetActiveDashboardItemRequest(defaultDasboardItem));
}
 
Example 6
Source File: Controller2.java    From uip-pc2 with MIT License 6 votes vote down vote up
public void salir(ActionEvent actionEvent) {
    Stage stage = (Stage) btn_salir.getScene().getWindow();
    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("sample.fxml"));
    Parent root = null;
    try {
        root = fxmlLoader.load();
    } catch (Exception e) {
        Alert alerta = new Alert(Alert.AlertType.ERROR);
        alerta.setTitle("Error de Aplicación");
        alerta.setContentText("Llama al lapecillo de sistemas.");
        alerta.showAndWait();
        Platform.exit();
    }
    FadeTransition ft = new FadeTransition(Duration.millis(1500), root);
    ft.setFromValue(0.0);
    ft.setToValue(1.0);
    ft.play();
    //? controller = fxmlLoader.<?>getController();
    //controller.setConteo(conteo);
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();
}
 
Example 7
Source File: CardRevealedToken.java    From metastone with GNU General Public License v2.0 6 votes vote down vote up
public CardRevealedToken(GameBoardView boardView, Card card, double delay) {
	Window parent = boardView.getScene().getWindow();
	this.cardToken = new CardTooltip();

	popup = new Popup();
	popup.getContent().setAll(cardToken);
	popup.setX(parent.getX() + 40);
	popup.show(parent);
	popup.setY(parent.getY() + parent.getHeight() * 0.5 - cardToken.getHeight() * 0.5);

	cardToken.setCard(card);
	NotificationProxy.sendNotification(GameNotification.ANIMATION_STARTED);
	FadeTransition animation = new FadeTransition(Duration.seconds(delay), cardToken);
	animation.setOnFinished(this::secondTransition);
	animation.setFromValue(0);
	animation.setToValue(0);
	animation.play();
}
 
Example 8
Source File: RadialMenu.java    From Enzo with Apache License 2.0 6 votes vote down vote up
public void show() {
    if (options.isButtonHideOnSelect() && mainMenuButton.getOpacity() > 0) {
        return;
    }

    if (options.isButtonHideOnSelect() || mainMenuButton.getOpacity() == 0) {
        mainMenuButton.setScaleX(1.0);
        mainMenuButton.setScaleY(1.0);
        cross.setRotate(0);
        mainMenuButton.setRotate(0);

        FadeTransition buttonFadeIn = new FadeTransition();
        buttonFadeIn.setNode(mainMenuButton);
        buttonFadeIn.setDuration(Duration.millis(200));
        buttonFadeIn.setToValue(options.getButtonAlpha());
        buttonFadeIn.play();
    }
    for (Parent node : items.keySet()) {
        node.setScaleX(1.0);
        node.setScaleY(1.0);
        node.setTranslateX(0);
        node.setTranslateY(0);
        node.setRotate(0);
    }
}
 
Example 9
Source File: AnimationHelper.java    From ApkToolPlus with Apache License 2.0 5 votes vote down vote up
/**
 * 淡出
 *
 * @param onFinish
 * @return
 */
public static FadeTransition fadeOut(EventHandler<ActionEvent> onFinish){
    FadeTransition ft = new FadeTransition(Duration.millis(500));
    ft.setFromValue(1.0);
    ft.setToValue(0.0);
    ft.setCycleCount(0);
    ft.setAutoReverse(false);
    if(onFinish != null){
        ft.setOnFinished(onFinish);
    }
    return ft;
}
 
Example 10
Source File: JaceUIController.java    From jace with GNU General Public License v2.0 5 votes vote down vote up
private void showControlOverlay(MouseEvent evt) {
    if (!evt.isPrimaryButtonDown() && !evt.isSecondaryButtonDown()) {
        delayTimer.stop();
        menuButtonPane.setVisible(false);
        controlOverlay.setVisible(true);
        FadeTransition ft = new FadeTransition(Duration.millis(500), controlOverlay);
        ft.setFromValue(0.0);
        ft.setToValue(1.0);
        ft.play();
        rootPane.requestFocus();
    }
}
 
Example 11
Source File: InfoPopup.java    From charts with Apache License 2.0 5 votes vote down vote up
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 12
Source File: GameView.java    From CrazyAlpha with GNU General Public License v2.0 5 votes vote down vote up
public static void makeFadeTransition(Node node, int millis, double fromValue, double toValue) {
    FadeTransition ft = new FadeTransition(Duration.millis(millis));
    ft.setFromValue(fromValue);
    ft.setToValue(toValue);
    ft.setCycleCount(Animation.INDEFINITE);
    ft.setAutoReverse(true);
    ft.setNode(node);
    ft.play();
}
 
Example 13
Source File: DashboardController.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
private void loadNode(Node node) {
	//System.out.println("loadNode()");
    insertPane.getChildren().clear();
    insertPane.getChildren().add((Node) node);

    FadeTransition ft = new FadeTransition(Duration.millis(1500));
    ft.setNode(node);
    ft.setFromValue(0.1);
    ft.setToValue(1);
    ft.setCycleCount(1);
    ft.setAutoReverse(false);
    ft.play();
}
 
Example 14
Source File: Undecorator.java    From DevToolBox with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Launch the fade out transition. Must be invoked when the
 * application/window is supposed to be closed
 */
public void setFadeOutTransition() {
    FadeTransition fadeTransition = new FadeTransition(Duration.seconds(1), Undecorator.this);
    fadeTransition.setToValue(0);
    fadeTransition.play();
    fadeTransition.setOnFinished((ActionEvent t) -> {
        stage.hide();
        if (dockFeedbackPopup != null && dockFeedbackPopup.isShowing()) {
            dockFeedbackPopup.hide();
        }
    });
}
 
Example 15
Source File: FXRouter.java    From FXRouter with GNU General Public License v3.0 5 votes vote down vote up
/** Animate routes switching based on animation type
 * @param resource: .FXML scene file to animate
 */
private static void routeAnimation(Parent node) {
    String anType = animationType != null ? animationType.toLowerCase() : "";
    switch(anType) {
        case "fade":
            Double fd = animationDuration != null ? animationDuration : FADE_ANIMATION_DURATION;
            FadeTransition ftCurrent = new FadeTransition(Duration.millis(fd), node);
            ftCurrent.setFromValue(0.0);
            ftCurrent.setToValue(1.0);
            ftCurrent.play();
            break;
        default:
            break;
    }
}
 
Example 16
Source File: MainController.java    From GreenBits with GNU General Public License v3.0 5 votes vote down vote up
public void readyToGoAnimation() {
    // Buttons slide in and clickable address appears simultaneously.
    TranslateTransition arrive = new TranslateTransition(Duration.millis(1200), controlsBox);
    arrive.setInterpolator(new ElasticInterpolator(EasingMode.EASE_OUT, 1, 2));
    arrive.setToY(0.0);
    FadeTransition reveal = new FadeTransition(Duration.millis(1200), addressControl);
    reveal.setToValue(1.0);
    ParallelTransition group = new ParallelTransition(arrive, reveal);
    group.setDelay(NotificationBarPane.ANIM_OUT_DURATION);
    group.setCycleCount(1);
    group.play();
}
 
Example 17
Source File: LowerKeyHandler.java    From stagedisplayviewer with MIT License 5 votes vote down vote up
public LowerKeyHandler(Text lowerKey, MidiModule midiModule) throws IOException {
    this.lowerKey = lowerKey;
    this.midiModule = midiModule;
    
    // Initialize fade animations for updating stage display text.
    fadeOut = new FadeTransition(Duration.millis(Property.FADE_TIME.toInt()), lowerKey);
    fadeOut.setFromValue(1.0);
    fadeOut.setToValue(0.0);
    
    fadeIn = new FadeTransition(Duration.millis(Property.FADE_TIME.toInt()), lowerKey);
    fadeIn.setFromValue(0.0);
    fadeIn.setToValue(1.0);
}
 
Example 18
Source File: MemoryPuzzleApp.java    From FXTutorials with MIT License 4 votes vote down vote up
public void open(Runnable action) {
    FadeTransition ft = new FadeTransition(Duration.seconds(0.5), text);
    ft.setToValue(1);
    ft.setOnFinished(e -> action.run());
    ft.play();
}
 
Example 19
Source File: Utils.java    From Cryogen with GNU General Public License v2.0 4 votes vote down vote up
public static void fadeOut(Node host, double duration) {
    FadeTransition ft = new FadeTransition(Duration.millis(duration), host);
    ft.setFromValue(1.0);
    ft.setToValue(0.0);
    ft.play();
}
 
Example 20
Source File: MemoryPuzzleApp.java    From FXTutorials with MIT License 4 votes vote down vote up
public void close() {
    FadeTransition ft = new FadeTransition(Duration.seconds(0.5), text);
    ft.setToValue(0);
    ft.play();
}