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

The following examples show how to use javafx.animation.FadeTransition#setNode() . 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: GameElimniationController.java    From MyBox with Apache License 2.0 6 votes vote down vote up
protected void flush(int i, int j) {
    if (flushTimes < 1) {
        return;
    }
    try {
        FadeTransition fade = new FadeTransition(Duration.millis(flushDuration));
        fade.setFromValue(1.0);
        fade.setToValue(0f);
        fade.setCycleCount(flushTimes * 2);
        fade.setAutoReverse(true);
        fade.setNode(chessBoard.get(i + "-" + j));
        fade.play();
    } catch (Exception e) {
        logger.debug(e.toString());
    }
}
 
Example 2
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 3
Source File: SelectionStripSkin.java    From WorkbenchFX with Apache License 2.0 5 votes vote down vote up
private FadeTransition createFadeTransition(Node node, double from, double to) {
  node.setOpacity(from);
  FadeTransition faderTransition = new FadeTransition();
  faderTransition.setNode(node);
  faderTransition.setFromValue(from);
  faderTransition.setToValue(to);
  faderTransition.setDuration(Duration.millis(200));
  return faderTransition;
}
 
Example 4
Source File: Undecorator.java    From DevToolBox with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Activate dock feedback on screen's bounds
 *
 * @param x
 * @param y
 * @param width
 * @param height
 */
public void setDockFeedbackVisible(double x, double y, double width, double height) {
    dockFeedbackPopup.setX(x);
    dockFeedbackPopup.setY(y);

    dockFeedback.setX(SHADOW_WIDTH);
    dockFeedback.setY(SHADOW_WIDTH);
    dockFeedback.setHeight(height - SHADOW_WIDTH * 2);
    dockFeedback.setWidth(width - SHADOW_WIDTH * 2);

    dockFeedbackPopup.setWidth(width);
    dockFeedbackPopup.setHeight(height);

    dockFeedback.setOpacity(1);
    dockFeedbackPopup.show();

    dockFadeTransition = new FadeTransition();
    dockFadeTransition.setDuration(Duration.millis(200));
    dockFadeTransition.setNode(dockFeedback);
    dockFadeTransition.setFromValue(0);
    dockFadeTransition.setToValue(1);
    dockFadeTransition.setAutoReverse(true);
    dockFadeTransition.setCycleCount(3);

    dockFadeTransition.play();

}
 
Example 5
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 6
Source File: SettingsActivity.java    From ApkToolPlus with Apache License 2.0 5 votes vote down vote up
public void close() {
    FadeTransition fadeTransition = AnimationHelper.fadeOut(event -> {
        ActivityManager.getRootView().getChildren().remove(getRootView());
    });
    fadeTransition.setNode(getRootView());
    fadeTransition.play();
    // 保存配置
    Config.save();
}
 
Example 7
Source File: ActivityManager.java    From ApkToolPlus with Apache License 2.0 5 votes vote down vote up
/**
 * 启动一个Activity
 *
 * @param url       界面布局文件url
 * @param pos       界面位置
 * @param animation 切换动画
 */
public static void startActivity(URL url, Pos pos, FadeTransition animation){
    try {
        Parent view = FXMLLoader.load(url);
        StackPane.setAlignment(view, pos);
        getRootView().getChildren().add(view);
        animation.setNode(view);
        animation.play();
    } catch (IOException e) {
        e.printStackTrace();
    }
}
 
Example 8
Source File: SettlersController.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
private void setupNode(Node node) {	
	innerVBox.getChildren().add((Node) node);      

    FadeTransition ft = new FadeTransition(Duration.millis(1000));
    ft.setNode(node);
    ft.setFromValue(0.1);
    ft.setToValue(1);
    ft.setCycleCount(1);
    ft.setAutoReverse(false);
    ft.play();

}
 
Example 9
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 10
Source File: GitFxDialog.java    From GitFx with Apache License 2.0 5 votes vote down vote up
public void applyFadeTransition(Dialog node) {
    FadeTransition fadeTransition = new FadeTransition();
    fadeTransition.setDuration(Duration.seconds(.5));
    fadeTransition.setNode(node.getDialogPane());
    fadeTransition.setFromValue(0);
    fadeTransition.setToValue(1);
    fadeTransition.play();
}
 
Example 11
Source File: RadialMenu.java    From Enzo with Apache License 2.0 4 votes vote down vote up
public void click(final MenuItem CLICKED_ITEM) {
    List<Transition> transitions = new ArrayList<>(items.size() * 2);
    for (Parent node : items.keySet()) {
        if (items.get(node).equals(CLICKED_ITEM)) {
            // Add enlarge transition to selected item
            ScaleTransition enlargeItem = new ScaleTransition(Duration.millis(300), node);
            enlargeItem.setToX(5.0);
            enlargeItem.setToY(5.0);
            transitions.add(enlargeItem);
        } else {
            // Add shrink transition to all other items
            ScaleTransition shrinkItem = new ScaleTransition(Duration.millis(300), node);
            shrinkItem.setToX(0.0);
            shrinkItem.setToY(0.0);
            transitions.add(shrinkItem);
        }
        // Add fade out transition to every node
        FadeTransition fadeOutItem = new FadeTransition(Duration.millis(300), node);
        fadeOutItem.setToValue(0.0);
        transitions.add(fadeOutItem);
    }

    // Add rotate and fade transition to main menu button
    if (options.isButtonHideOnSelect()) {
        RotateTransition rotateMainButton = new RotateTransition(Duration.millis(300), mainMenuButton);
        rotateMainButton.setToAngle(225);
        transitions.add(rotateMainButton);
        FadeTransition fadeOutMainButton = new FadeTransition(Duration.millis(300), mainMenuButton);
        fadeOutMainButton.setToValue(0.0);
        transitions.add(fadeOutMainButton);
        ScaleTransition shrinkMainButton = new ScaleTransition(Duration.millis(300), mainMenuButton);
        shrinkMainButton.setToX(0.0);
        shrinkMainButton.setToY(0.0);
        transitions.add(shrinkMainButton);
    } else {
        RotateTransition rotateBackMainButton = new RotateTransition();
        rotateBackMainButton.setNode(cross);
        rotateBackMainButton.setToAngle(0);
        rotateBackMainButton.setDuration(Duration.millis(200));
        rotateBackMainButton.setInterpolator(Interpolator.EASE_BOTH);
        transitions.add(rotateBackMainButton);
        FadeTransition mainButtonFadeOut = new FadeTransition();
        mainButtonFadeOut.setNode(mainMenuButton);
        mainButtonFadeOut.setDuration(Duration.millis(100));
        mainButtonFadeOut.setToValue(options.getButtonAlpha());
        transitions.add(mainButtonFadeOut);
    }

    // Play all transitions in parallel
    ParallelTransition selectTransition = new ParallelTransition();
    selectTransition.getChildren().addAll(transitions);
    selectTransition.play();

    // Set menu state back to closed
    setState(State.CLOSED);
    mainMenuButton.setOpen(false);
}