Search in sources :

Example 1 with KeyValue

use of javafx.animation.KeyValue in project TrayNotification by PlusHaze.

the class FadeAnimation method setupDismissAnimation.

/**
     *
     * @return a constructed instance of a dismiss fade animation
     */
private Timeline setupDismissAnimation() {
    Timeline tl = new Timeline();
    //At this stage the opacity is already at 1.0
    //Lowers the opacity to 0.0 within 2000 milliseconds
    KeyValue kv1 = new KeyValue(stage.opacityProperty(), 0.0);
    KeyFrame kf1 = new KeyFrame(Duration.millis(2000), kv1);
    tl.getKeyFrames().addAll(kf1);
    //Action to be performed when the animation has finished
    tl.setOnFinished(e -> {
        trayIsShowing = false;
        stage.close();
        stage.setLocation(stage.getBottomRight());
    });
    return tl;
}
Also used : Timeline(javafx.animation.Timeline) KeyValue(javafx.animation.KeyValue) KeyFrame(javafx.animation.KeyFrame)

Example 2 with KeyValue

use of javafx.animation.KeyValue in project TrayNotification by PlusHaze.

the class FadeAnimation method setupShowAnimation.

/**
     *
     * @return a constructed instance of a show fade animation
     */
private Timeline setupShowAnimation() {
    Timeline tl = new Timeline();
    //Sets opacity to 0.0 instantly which is pretty much invisible
    KeyValue kvOpacity = new KeyValue(stage.opacityProperty(), 0.0);
    KeyFrame frame1 = new KeyFrame(Duration.ZERO, kvOpacity);
    //Sets opacity to 1.0 (fully visible) over the time of 3000 milliseconds.
    KeyValue kvOpacity2 = new KeyValue(stage.opacityProperty(), 1.0);
    KeyFrame frame2 = new KeyFrame(Duration.millis(3000), kvOpacity2);
    tl.getKeyFrames().addAll(frame1, frame2);
    tl.setOnFinished(e -> trayIsShowing = true);
    return tl;
}
Also used : Timeline(javafx.animation.Timeline) KeyValue(javafx.animation.KeyValue) KeyFrame(javafx.animation.KeyFrame)

Example 3 with KeyValue

use of javafx.animation.KeyValue in project TrayNotification by PlusHaze.

the class FadeAnimation method setupDismissAnimation.

@Override
protected Timeline setupDismissAnimation() {
    Timeline tl = new Timeline();
    // At this stage the opacity is already at 1.0
    // Lowers the opacity to 0.0 within 2000 milliseconds
    KeyValue kv1 = new KeyValue(stage.opacityProperty(), 0.0);
    KeyFrame kf1 = new KeyFrame(Duration.millis(2000), kv1);
    tl.getKeyFrames().addAll(kf1);
    // Action to be performed when the animation has finished
    tl.setOnFinished(e -> {
        trayIsShowing = false;
        stage.close();
        stage.setLocation(stage.getBottomRight());
    });
    return tl;
}
Also used : Timeline(javafx.animation.Timeline) KeyValue(javafx.animation.KeyValue) KeyFrame(javafx.animation.KeyFrame)

Example 4 with KeyValue

use of javafx.animation.KeyValue in project JFoenix by jfoenixadmin.

the class ValidationFacade method hideError.

private void hideError() {
    if (heightChanged) {
        new Timeline(new KeyFrame(Duration.millis(160), new KeyValue(translateYProperty(), 0, Interpolator.EASE_BOTH))).play();
        // reset the height of text field
        new Timeline(new KeyFrame(Duration.millis(160), new KeyValue(minHeightProperty(), initHeight, Interpolator.EASE_BOTH))).play();
        heightChanged = false;
    }
    // clear error label text
    errorLabel.setText(null);
    oldErrorLabelHeight = errorLabelInitHeight;
    // clear error icon
    errorIcon.getChildren().clear();
    // reset the height of the text field
    currentFieldHeight = initHeight;
    // hide error container
    errorContainer.setVisible(false);
    errorShown = false;
}
Also used : Timeline(javafx.animation.Timeline) KeyValue(javafx.animation.KeyValue) KeyFrame(javafx.animation.KeyFrame)

Example 5 with KeyValue

use of javafx.animation.KeyValue in project JFoenix by jfoenixadmin.

the class JFXListCell method initListeners.

/**
	 * init listeners to update the vertical gap / selection animation
	 */
private void initListeners() {
    listViewProperty().addListener((listObj, oldList, newList) -> {
        if (newList != null) {
            if (getListView() instanceof JFXListView) {
                ((JFXListView<?>) newList).currentVerticalGapProperty().addListener((o, oldVal, newVal) -> {
                    cellRippler.rippler.setClip(null);
                    if (newVal.doubleValue() != 0) {
                        playExpandAnimation = true;
                        getListView().requestLayout();
                    } else {
                        // fake expand state
                        double gap = clip.getY() * 2;
                        gapAnimation = new Timeline(new KeyFrame(Duration.millis(240), new KeyValue(this.translateYProperty(), -gap / 2 - (gap * (getIndex())), Interpolator.EASE_BOTH)));
                        gapAnimation.play();
                        gapAnimation.setOnFinished((finish) -> {
                            requestLayout();
                            Platform.runLater(() -> getListView().requestLayout());
                        });
                    }
                });
                selectedProperty().addListener((o, oldVal, newVal) -> {
                    if (newVal)
                        selectionChanged = true;
                });
            }
        }
    });
}
Also used : Timeline(javafx.animation.Timeline) KeyValue(javafx.animation.KeyValue) KeyFrame(javafx.animation.KeyFrame)

Aggregations

KeyValue (javafx.animation.KeyValue)81 KeyFrame (javafx.animation.KeyFrame)79 Timeline (javafx.animation.Timeline)78 Interpolator (javafx.animation.Interpolator)12 Rotate (javafx.scene.transform.Rotate)12 PerspectiveCamera (javafx.scene.PerspectiveCamera)9 MouseEvent (javafx.scene.input.MouseEvent)9 Duration (javafx.util.Duration)9 ArrayList (java.util.ArrayList)8 Insets (javafx.geometry.Insets)8 Scene (javafx.scene.Scene)7 Group (javafx.scene.Group)6 Node (javafx.scene.Node)6 KeyCode (javafx.scene.input.KeyCode)6 StackPane (javafx.scene.layout.StackPane)6 VBox (javafx.scene.layout.VBox)6 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)5 AnimationTimer (javafx.animation.AnimationTimer)5 ActionEvent (javafx.event.ActionEvent)5 PointLight (javafx.scene.PointLight)5