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

The following examples show how to use javafx.animation.FadeTransition#setAutoReverse() . 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: LoadingPane.java    From Quelea with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Create the loading pane.
 */
public LoadingPane() {
    setAlignment(Pos.CENTER);
    VBox content = new VBox();
    content.setAlignment(Pos.CENTER);
    Text text = new Text(LabelGrabber.INSTANCE.getLabel("loading.text") + "...");
    text.setStyle(" -fx-font: bold italic 20pt \"Arial\";");
    FadeTransition textTransition = new FadeTransition(Duration.seconds(1.5), text);
    textTransition.setAutoReverse(true);
    textTransition.setFromValue(0);
    textTransition.setToValue(1);
    textTransition.setCycleCount(Transition.INDEFINITE);
    textTransition.play();
    content.getChildren().add(text);
    bar = new ProgressBar();
    content.getChildren().add(bar);
    getChildren().add(content);
    setOpacity(0);
    setStyle("-fx-background-color: #555555;");
    setVisible(false);
}
 
Example 2
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 3
Source File: JFXBadge.java    From JFoenix with Apache License 2.0 6 votes vote down vote up
public void refreshBadge() {
    badge.getChildren().clear();
    if (enabled) {


        Label labelControl = new Label(text.getValue());

        StackPane badgePane = new StackPane();
        badgePane.getStyleClass().add("badge-pane");
        badgePane.getChildren().add(labelControl);
        //Adding a clip would avoid overlap but this does not work as intended
        //badgePane.setClip(clip);
        badge.getChildren().add(badgePane);
        StackPane.setAlignment(badge, getPosition());

        FadeTransition ft = new FadeTransition(Duration.millis(666), badge);
        ft.setFromValue(0);
        ft.setToValue(1.0);
        ft.setCycleCount(1);
        ft.setAutoReverse(true);
        ft.play();
    }
}
 
Example 4
Source File: MKXMenuApp.java    From FXTutorials with MIT License 6 votes vote down vote up
private Node createRightContent() {
    String title = "Please Subscribe :)";
    HBox letters = new HBox(0);
    letters.setAlignment(Pos.CENTER);
    for (int i = 0; i < title.length(); i++) {
        Text letter = new Text(title.charAt(i) + "");
        letter.setFont(FONT);
        letter.setFill(Color.WHITE);
        letter.setOpacity(0);
        letters.getChildren().add(letter);

        FadeTransition ft = new FadeTransition(Duration.seconds(2), letter);
        ft.setDelay(Duration.millis(i * 50));
        ft.setToValue(1);
        ft.setAutoReverse(true);
        ft.setCycleCount(TranslateTransition.INDEFINITE);
        ft.play();
    }

    return letters;
}
 
Example 5
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 6
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 7
Source File: AnimationHelper.java    From ApkToolPlus with Apache License 2.0 5 votes vote down vote up
/**
 * 淡入
 *
 * @param onFinish
 * @return
 */
public static FadeTransition fadeIn(EventHandler<ActionEvent> onFinish){
    FadeTransition ft = new FadeTransition(Duration.millis(500));
    ft.setFromValue(0.0);
    ft.setToValue(1.1);
    ft.setCycleCount(0);
    ft.setAutoReverse(false);
    if(onFinish != null){
        ft.setOnFinished(onFinish);
    }
    return ft;
}
 
Example 8
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 9
Source File: AnimationHelper.java    From ApkToolPlus with Apache License 2.0 5 votes vote down vote up
/**
 * 闪烁
 *
 * @param node
 */
public static FadeTransition blink(Node node, EventHandler<ActionEvent> onFinish){
    FadeTransition ft = new FadeTransition(Duration.millis(3000), node);
    ft.setFromValue(1.0);
    ft.setToValue(0.1);
    ft.setCycleCount(Timeline.INDEFINITE);
    ft.setAutoReverse(true);
    if(onFinish != null){
        ft.setOnFinished(onFinish);
    }
    return ft;
}
 
Example 10
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 11
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 12
Source File: Exercise_15_26.java    From Intro-to-Java-Programming with MIT License 4 votes vote down vote up
@Override // Override the start method in the Application class
public void start(Stage primaryStage) {
	// Create a pane
	Pane pane = new Pane();

	// Create a arc
	Arc arc = new Arc(100, 50, 75, 25, 0, -180);
	arc.setFill(Color.WHITE);
	arc.setStroke(Color.BLACK);

	// Create a circle
	Circle ball = new Circle(100, 75, 10);

	// Place nodes in pane
	pane.getChildren().addAll(arc, ball);

	// Create a path transition
	PathTransition pt = new PathTransition();
	pt.setDuration(Duration.millis(4000));
	pt.setPath(arc);
	pt.setNode(ball);
	pt.setOrientation(
		PathTransition.OrientationType.ORTHOGONAL_TO_TANGENT);
	pt.setCycleCount(Timeline.INDEFINITE);
	pt.setAutoReverse(true);
	pt.play(); // Start animation

	// Create a fade transition to ball
	FadeTransition ft = 
		new FadeTransition(Duration.millis(4000), ball);
	ft.setFromValue(1.0);
	ft.setToValue(0.1);
	ft.setCycleCount(Timeline.INDEFINITE);
	ft.setAutoReverse(true);
	ft.play(); // Start animation

	// Create and register the handle
	pane.setOnMousePressed(e -> {
		pt.pause();
		ft.pause();
	});

	pane.setOnMouseReleased(e -> {
		pt.play();
		ft.play();
	});

	// Create a scene and place it in the stage
	Scene scene = new Scene(pane, 200, 100);
	primaryStage.setTitle("Exercise_15_26"); // Set the stage title
	primaryStage.setScene(scene); // Place the scene in the stage
	primaryStage.show(); // Display the stage
}