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

The following examples show how to use javafx.animation.FadeTransition#setFromValue() . 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: 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 3
Source File: Resumen.java    From uip-pc2 with MIT License 6 votes vote down vote up
public void salir(MouseEvent mouseEvent) {
    Stage stage = (Stage) salir.getScene().getWindow();
    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("Login.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();
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();
}
 
Example 4
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 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: ParetoInfoPopup.java    From charts with Apache License 2.0 6 votes vote down vote up
private void init() {
    setAutoFix(true);
    rowCount = 2;

    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 7
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 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: JaceUIController.java    From jace with GNU General Public License v2.0 5 votes vote down vote up
private void showMenuButton(MouseEvent evt) {
    if (!evt.isPrimaryButtonDown() && !evt.isSecondaryButtonDown() && !controlOverlay.isVisible()) {
        resetMenuButtonTimer();
        if (!menuButtonPane.isVisible()) {
            menuButtonPane.setVisible(true);
            FadeTransition ft = new FadeTransition(Duration.millis(500), menuButtonPane);
            ft.setFromValue(0.0);
            ft.setToValue(1.0);
            ft.play();
        }
    }
    rootPane.requestFocus();
}
 
Example 10
Source File: HeatControlSkin.java    From Enzo with Apache License 2.0 5 votes vote down vote up
private void fadeBack() {
    FadeTransition fadeInfoTextOut = new FadeTransition(Duration.millis(425), infoText);
    fadeInfoTextOut.setFromValue(1.0);
    fadeInfoTextOut.setToValue(0.0);
    
    FadeTransition fadeValueOut = new FadeTransition(Duration.millis(425), value);
    fadeValueOut.setFromValue(1.0);
    fadeValueOut.setToValue(0.0);

    PauseTransition pause = new PauseTransition(Duration.millis(50));

    FadeTransition fadeInfoTextIn = new FadeTransition(Duration.millis(425), infoText);
    fadeInfoTextIn.setFromValue(0.0);
    fadeInfoTextIn.setToValue(1.0);
    
    FadeTransition fadeValueIn = new FadeTransition(Duration.millis(425), value);
    fadeValueIn.setFromValue(0.0);
    fadeValueIn.setToValue(1.0);                
    
    ParallelTransition parallelIn = new ParallelTransition(fadeInfoTextIn, fadeValueIn);

    ParallelTransition parallelOut = new ParallelTransition(fadeInfoTextOut, fadeValueOut);
    parallelOut.setOnFinished(event -> {
        double currentValue = (valueIndicatorRotate.getAngle() + getSkinnable().getStartAngle() - 180) / angleStep + getSkinnable().getMinValue();
        value.setText(String.format(Locale.US, "%." + getSkinnable().getDecimals() + "f", currentValue));
        value.setTranslateX((size - value.getLayoutBounds().getWidth()) * 0.5);
        if (getSkinnable().getTarget() < getSkinnable().getValue()) {
            getSkinnable().setInfoText("COOLING");
        } else if (getSkinnable().getTarget() > getSkinnable().getValue()) {
            getSkinnable().setInfoText("HEATING");
        }
        
        resizeText();
        drawTickMarks(ticks);
        userAction = false;
    });

    SequentialTransition sequence = new SequentialTransition(parallelOut, pause, parallelIn);
    sequence.play();
}
 
Example 11
Source File: CardRevealedToken.java    From metastone with GNU General Public License v2.0 5 votes vote down vote up
private void nextTransition(ActionEvent event) {
	FadeTransition animation = new FadeTransition(Duration.seconds(.6), cardToken);
	animation.setOnFinished(this::onComplete);
	animation.setFromValue(1);
	animation.setToValue(0);
	animation.play();
}
 
Example 12
Source File: SplashScreenUIController.java    From RentLio with Apache License 2.0 5 votes vote down vote up
private void loadSplashScreen(){
    
    StartRentLio.isSplashLoaded = true;
    AnchorPane splashPane = null;
    try {
        splashPane = FXMLLoader.load(getClass()
                .getResource("/fxml/SplashScreenUI.fxml"));
    } catch (IOException e) {
        e.printStackTrace();
    }
    root.getChildren().setAll(splashPane);

    FadeTransition fadeIn = new FadeTransition(Duration.seconds(3), splashPane);
    fadeIn.setFromValue(0);
    fadeIn.setToValue(1);

    fadeIn.setCycleCount(1);

    FadeTransition fadeOut = new FadeTransition(Duration.seconds(3), splashPane);
    fadeOut.setFromValue(1);
    fadeOut.setToValue(0);
    fadeOut.setCycleCount(1);

    fadeIn.play();

    fadeIn.setOnFinished((e) -> fadeOut.play());

    fadeOut.setOnFinished((e) -> {
        AnchorPane parentContent = CustomStage.getDefaultSceneManager().getScene("LoginUI");
        root.getChildren().setAll(parentContent);
    });
}
 
Example 13
Source File: RadialBargraphSkin.java    From Enzo with Apache License 2.0 5 votes vote down vote up
private void fadeBackToInteractive() {
    FadeTransition fadeUnitOut = new FadeTransition(Duration.millis(425), unit);
    fadeUnitOut.setFromValue(1.0);
    fadeUnitOut.setToValue(0.0);
    FadeTransition fadeValueOut = new FadeTransition(Duration.millis(425), value);
    fadeValueOut.setFromValue(1.0);
    fadeValueOut.setToValue(0.0);

    PauseTransition pause = new PauseTransition(Duration.millis(50));

    FadeTransition fadeUnitIn = new FadeTransition(Duration.millis(425), unit);
    fadeUnitIn.setFromValue(0.0);
    fadeUnitIn.setToValue(1.0);
    FadeTransition fadeValueIn = new FadeTransition(Duration.millis(425), value);
    fadeValueIn.setFromValue(0.0);
    fadeValueIn.setToValue(1.0);
    ParallelTransition parallelIn = new ParallelTransition(fadeUnitIn, fadeValueIn);

    ParallelTransition parallelOut = new ParallelTransition(fadeUnitOut, fadeValueOut);
    parallelOut.setOnFinished(event -> {
        unit.setText("Interactive");
        value.setText("");
        resizeText();
    });

    SequentialTransition sequence = new SequentialTransition(parallelOut, pause, parallelIn);
    sequence.play();
}
 
Example 14
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 15
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 16
Source File: JoustToken.java    From metastone with GNU General Public License v2.0 5 votes vote down vote up
public JoustToken(GameBoardView boardView, Card card, boolean up, boolean won) {
	Window parent = boardView.getScene().getWindow();
	this.cardToken = new CardTooltip();

	popup = new Popup();
	popup.getContent().setAll(cardToken);
	popup.setX(parent.getX() + 600);
	popup.show(parent);
	int offsetY = up ? -200 : 100;
	popup.setY(parent.getY() + parent.getHeight() * 0.5 - cardToken.getHeight() * 0.5 + offsetY);

	cardToken.setCard(card);

	NotificationProxy.sendNotification(GameNotification.ANIMATION_STARTED);
	FadeTransition animation = new FadeTransition(Duration.seconds(1.0), cardToken);
	animation.setDelay(Duration.seconds(1f));
	animation.setOnFinished(this::onComplete);
	animation.setFromValue(1);
	animation.setToValue(0);
	animation.play();
	
	if (won) {
		ScaleTransition scaleAnimation = new ScaleTransition(Duration.seconds(0.5f), cardToken);
		scaleAnimation.setByX(0.1);
		scaleAnimation.setByY(0.1);
		scaleAnimation.setCycleCount(2);
		scaleAnimation.setAutoReverse(true);
		scaleAnimation.play();	
	}
}
 
Example 17
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 18
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 19
Source File: ProfileController.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private void animateMessage() {
    FadeTransition ft = new FadeTransition(Duration.millis(1000), success);
    ft.setFromValue(0.0);
    ft.setToValue(1);
    ft.play();
}
 
Example 20
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
}