use of javafx.animation.KeyValue in project JFoenix by jfoenixadmin.
the class JFXSnackbar method close.
public void close() {
Timeline animation = new Timeline(new KeyFrame(Duration.ZERO, (e) -> popup.toFront(), new KeyValue(popup.opacityProperty(), 1, easeInterpolator), new KeyValue(popup.translateYProperty(), 0, easeInterpolator)), new KeyFrame(Duration.millis(290), new KeyValue(popup.visibleProperty(), true, Interpolator.EASE_BOTH)), new KeyFrame(Duration.millis(300), (e) -> popup.toBack(), new KeyValue(popup.visibleProperty(), false, Interpolator.EASE_BOTH), new KeyValue(popup.translateYProperty(), popup.getLayoutBounds().getHeight(), easeInterpolator), new KeyValue(popup.opacityProperty(), 0, easeInterpolator)));
animation.setCycleCount(1);
animation.setOnFinished((e) -> processSnackbars());
animation.play();
}
use of javafx.animation.KeyValue in project JFoenix by jfoenixadmin.
the class JFXSnackbar method getTimeline.
private Timeline getTimeline(long timeout) {
Timeline animation;
if (timeout <= 0) {
animation = new Timeline(new KeyFrame(Duration.ZERO, (e) -> popup.toBack(), new KeyValue(popup.visibleProperty(), false, Interpolator.EASE_BOTH), new KeyValue(popup.translateYProperty(), popup.getLayoutBounds().getHeight(), easeInterpolator), new KeyValue(popup.opacityProperty(), 0, easeInterpolator)), new KeyFrame(Duration.millis(10), (e) -> popup.toFront(), new KeyValue(popup.visibleProperty(), true, Interpolator.EASE_BOTH)), new KeyFrame(Duration.millis(300), new KeyValue(popup.opacityProperty(), 1, easeInterpolator), new KeyValue(popup.translateYProperty(), 0, easeInterpolator)));
animation.setCycleCount(1);
} else {
animation = new Timeline(new KeyFrame(Duration.ZERO, (e) -> popup.toBack(), new KeyValue(popup.visibleProperty(), false, Interpolator.EASE_BOTH), new KeyValue(popup.translateYProperty(), popup.getLayoutBounds().getHeight(), easeInterpolator), new KeyValue(popup.opacityProperty(), 0, easeInterpolator)), new KeyFrame(Duration.millis(10), (e) -> popup.toFront(), new KeyValue(popup.visibleProperty(), true, Interpolator.EASE_BOTH)), new KeyFrame(Duration.millis(300), new KeyValue(popup.opacityProperty(), 1, easeInterpolator), new KeyValue(popup.translateYProperty(), 0, easeInterpolator)), new KeyFrame(Duration.millis(timeout / 2)));
animation.setAutoReverse(true);
animation.setCycleCount(2);
animation.setOnFinished((e) -> processSnackbars());
}
return animation;
}
use of javafx.animation.KeyValue in project JFoenix by jfoenixadmin.
the class JFXSpinner method getKeyFrames.
private KeyFrame[] getKeyFrames(double angle, double duration, Color color) {
KeyFrame[] frames = new KeyFrame[4];
frames[0] = new KeyFrame(Duration.seconds(duration), new KeyValue(arc.lengthProperty(), 5, Interpolator.LINEAR), new KeyValue(arc.startAngleProperty(), angle + 45 + getStartingAngle(), Interpolator.LINEAR));
frames[1] = new KeyFrame(Duration.seconds(duration + 0.4), new KeyValue(arc.lengthProperty(), 250, Interpolator.LINEAR), new KeyValue(arc.startAngleProperty(), angle + 90 + getStartingAngle(), Interpolator.LINEAR));
frames[2] = new KeyFrame(Duration.seconds(duration + 0.7), new KeyValue(arc.lengthProperty(), 250, Interpolator.LINEAR), new KeyValue(arc.startAngleProperty(), angle + 135 + getStartingAngle(), Interpolator.LINEAR));
frames[3] = new KeyFrame(Duration.seconds(duration + 1.1), new KeyValue(arc.lengthProperty(), 5, Interpolator.LINEAR), new KeyValue(arc.startAngleProperty(), angle + 435 + getStartingAngle(), Interpolator.LINEAR), new KeyValue(arc.strokeProperty(), color, Interpolator.EASE_BOTH));
return frames;
}
use of javafx.animation.KeyValue in project JFoenix by jfoenixadmin.
the class JFXTogglePane method updateToggleAnimation.
private void updateToggleAnimation() {
if (getContentNode() == null)
return;
double rateX = this.getWidth() / getClip().getLayoutBounds().getWidth();
double rateY = this.getHeight() / getClip().getLayoutBounds().getHeight();
double newRate = Math.max(rateX, rateY) * getScalingFactor();
double animationRate = toggleAnimation == null ? -1 : toggleAnimation.getRate();
toggleAnimation = new Timeline(new KeyFrame(Duration.millis(0), new KeyValue(getClip().scaleXProperty(), 1, Interpolator.EASE_BOTH)), new KeyFrame(Duration.millis(0), new KeyValue(getClip().scaleYProperty(), 1, Interpolator.EASE_BOTH)), new KeyFrame(Duration.millis(0), new KeyValue(getContentNode().opacityProperty(), 0, Interpolator.EASE_BOTH)), new KeyFrame(Duration.millis(350), new KeyValue(getClip().scaleXProperty(), newRate, Interpolator.EASE_BOTH)), new KeyFrame(Duration.millis(350), new KeyValue(getClip().scaleYProperty(), newRate, Interpolator.EASE_BOTH)), new KeyFrame(Duration.millis(370), new KeyValue(getContentNode().opacityProperty(), 0, Interpolator.EASE_BOTH)), new KeyFrame(Duration.millis(510), new KeyValue(getContentNode().opacityProperty(), 1, Interpolator.EASE_BOTH)));
toggleAnimation.setOnFinished((finish) -> {
if (toggleAnimation.getRate() == 1) {
this.getClip().scaleXProperty().bind(Bindings.createDoubleBinding(() -> {
double X = this.getWidth() / getClip().getLayoutBounds().getWidth();
double Y = this.getHeight() / getClip().getLayoutBounds().getHeight();
double scale = Math.max(X, Y) * getScalingFactor();
return scale;
}, this.widthProperty(), this.heightProperty()));
this.getClip().scaleYProperty().bind(Bindings.createDoubleBinding(() -> {
double X = this.getWidth() / getClip().getLayoutBounds().getWidth();
double Y = this.getHeight() / getClip().getLayoutBounds().getHeight();
double scale = Math.max(X, Y) * getScalingFactor();
return scale;
}, this.widthProperty(), this.heightProperty()));
}
});
toggleAnimation.setRate(animationRate);
}
use of javafx.animation.KeyValue in project JFoenix by jfoenixadmin.
the class JFXTreeCell method createSibAnimation.
private Timeline createSibAnimation(TreeCell<?> cell, int index) {
cell.setTranslateY(((JFXTreeView<T>) getTreeView()).height);
Timeline f2 = new Timeline(new KeyFrame(Duration.millis(120), new KeyValue(cell.translateYProperty(), 0, Interpolator.EASE_BOTH)));
return f2;
}
Aggregations