use of javafx.animation.Timeline 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;
}
use of javafx.animation.Timeline 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;
}
use of javafx.animation.Timeline 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;
}
use of javafx.animation.Timeline 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;
}
use of javafx.animation.Timeline 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;
});
}
}
});
}
Aggregations