public static void hackTooltipStartTiming(Tooltip tooltip) { try { Field fieldBehavior = tooltip.getClass().getDeclaredField("BEHAVIOR"); fieldBehavior.setAccessible(true); Object objBehavior = fieldBehavior.get(tooltip); Field fieldTimer = objBehavior.getClass().getDeclaredField("activationTimer"); fieldTimer.setAccessible(true); Timeline objTimer = (Timeline) fieldTimer.get(objBehavior); objTimer.getKeyFrames().clear(); objTimer.getKeyFrames().add(new KeyFrame(new Duration(250))); } catch (Exception e) { e.printStackTrace(); } }
@Override public Animation animateEntrance() { return new Timeline(new KeyFrame(Duration.millis(320), new KeyValue(nextPage.opacityProperty(), 1, EASE_BOTH))); }
/** * creates error animation frames when moving from small -> large error container * * @return */ private KeyFrame createScaleToOneFrames() { return new KeyFrame(Duration.millis(100), new KeyValue(errorClipScale.yProperty(), 1, Interpolator.EASE_BOTH)); }
private void releaseRipple() { Ripple ripple = ripplesQueue.poll(); if(ripple!=null) { ripple.inAnimation.stop(); ripple.outAnimation = new Timeline( new KeyFrame(Duration.millis(Math.min(800, (0.9 * 500) / ripple.getScaleX())) , ripple.outKeyValues)); ripple.outAnimation.setOnFinished((event) -> getChildren().remove(ripple)); ripple.outAnimation.play(); if (generating.getAndSet(false)) { if (overlayRect != null) { overlayRect.inAnimation.stop(); if (!forceOverlay) overlayRect.outAnimation.play(); } } } }
private BiFunction<Boolean, Duration, Collection<KeyFrame>> initDefaultAnimation(Node child) { return (expanded, duration) -> { ArrayList<KeyFrame> frames = new ArrayList<>(); frames.add(new KeyFrame(duration, event -> { child.setScaleX(expanded ? 1 : 0); child.setScaleY(expanded ? 1 : 0); }, new KeyValue(child.scaleXProperty(), expanded ? 1 : 0, Interpolator.EASE_BOTH), new KeyValue(child.scaleYProperty(), expanded ? 1 : 0, Interpolator.EASE_BOTH) )); return frames; }; }
@Override public Animation animateExit() { final Integer endValue = 0; return new Timeline( new KeyFrame(Duration.millis(300), new KeyValue(main.opacityProperty(), endValue, EASE_BOTH)), new KeyFrame(Duration.millis(520), new KeyValue(colorPane1.translateXProperty(), endValue, EASE_BOTH), new KeyValue(colorPane1.translateYProperty(), endValue, EASE_BOTH)), new KeyFrame(Duration.millis(200), new KeyValue(colorPane1.scaleXProperty(), 1, EASE_BOTH), new KeyValue(colorPane1.scaleYProperty(), 1, EASE_BOTH)), new KeyFrame(Duration.millis(1000), new KeyValue(colorPane1.scaleXProperty(), 40, EASE_BOTH), new KeyValue(colorPane1.scaleYProperty(), 40, EASE_BOTH))); }
@Override public <U> void setViewContext(ViewContext<U> context) { updatePlaceholder(context.getRootNode()); if (animation != null) { animation.stop(); } animation = new Timeline(); animation.getKeyFrames().addAll(animationProducer.apply(this)); animation.getKeyFrames().add(new KeyFrame(duration, (e) -> clearPlaceholder())); animation.play(); }
@PostConstruct public void init() { Timeline timeline = new Timeline( new KeyFrame( Duration.ZERO, new KeyValue(blueSpinner.progressProperty(), 0), new KeyValue(greenSpinner.progressProperty(), 0) ), new KeyFrame( Duration.seconds(0.5), new KeyValue(greenSpinner.progressProperty(), 0.5) ), new KeyFrame( Duration.seconds(2), new KeyValue(blueSpinner.progressProperty(), 1), new KeyValue(greenSpinner.progressProperty(), 1) ) ); timeline.setCycleCount(Timeline.INDEFINITE); timeline.play(); }
/** * creates error animation frames when moving from large -> small error container * * @param errorContainerHeight * @return */ private KeyFrame createSmallerScaleFrame(double errorContainerHeight) { return new KeyFrame(Duration.millis(100), new KeyValue(errorClipScale.yProperty(), errorContainerHeight / getHeight(), Interpolator.EASE_BOTH)); }
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; }
/** * init fxml when loaded. */ @PostConstruct public void init() { Timeline task = new Timeline( new KeyFrame( Duration.ZERO, new KeyValue(progress1.progressProperty(), 0), new KeyValue(progress2.progressProperty(), 0), new KeyValue(progress2.secondaryProgressProperty(), 0.5)), new KeyFrame( Duration.seconds(1), new KeyValue(progress2.secondaryProgressProperty(), 1)), new KeyFrame( Duration.seconds(2), new KeyValue(progress1.progressProperty(), 1), new KeyValue(progress2.progressProperty(), 1))); task.setCycleCount(Timeline.INDEFINITE); task.play(); }
RightTransition() { super(contentHolder, new Timeline( new KeyFrame(Duration.ZERO, new KeyValue(contentHolder.translateXProperty(), offsetX, Interpolator.EASE_BOTH), new KeyValue(JFXDialog.this.visibleProperty(), false, Interpolator.EASE_BOTH) ), new KeyFrame(Duration.millis(10), new KeyValue(JFXDialog.this.visibleProperty(), true, Interpolator.EASE_BOTH), new KeyValue(JFXDialog.this.opacityProperty(), 0, Interpolator.EASE_BOTH) ), new KeyFrame(Duration.millis(1000), new KeyValue(contentHolder.translateXProperty(), 0, Interpolator.EASE_BOTH), new KeyValue(JFXDialog.this.opacityProperty(), 1, Interpolator.EASE_BOTH))) ); // reduce the number to increase the shifting , increase number to reduce shifting setCycleDuration(Duration.seconds(0.4)); setDelay(Duration.seconds(0)); } }
BottomTransition() { super(contentHolder, new Timeline( new KeyFrame(Duration.ZERO, new KeyValue(contentHolder.translateYProperty(), offsetY, Interpolator.EASE_BOTH), new KeyValue(JFXDialog.this.visibleProperty(), false, Interpolator.EASE_BOTH) ), new KeyFrame(Duration.millis(10), new KeyValue(JFXDialog.this.visibleProperty(), true, Interpolator.EASE_BOTH), new KeyValue(JFXDialog.this.opacityProperty(), 0, Interpolator.EASE_BOTH) ), new KeyFrame(Duration.millis(1000), new KeyValue(contentHolder.translateYProperty(), 0, Interpolator.EASE_BOTH), new KeyValue(JFXDialog.this.opacityProperty(), 1, Interpolator.EASE_BOTH))) ); // reduce the number to increase the shifting , increase number to reduce shifting setCycleDuration(Duration.seconds(0.4)); setDelay(Duration.seconds(0)); } }
LeftTransition() { super(contentHolder, new Timeline( new KeyFrame(Duration.ZERO, new KeyValue(contentHolder.translateXProperty(), -offsetX, Interpolator.EASE_BOTH), new KeyValue(JFXDialog.this.visibleProperty(), false, Interpolator.EASE_BOTH) ), new KeyFrame(Duration.millis(10), new KeyValue(JFXDialog.this.visibleProperty(), true, Interpolator.EASE_BOTH), new KeyValue(JFXDialog.this.opacityProperty(), 0, Interpolator.EASE_BOTH) ), new KeyFrame(Duration.millis(1000), new KeyValue(contentHolder.translateXProperty(), 0, Interpolator.EASE_BOTH), new KeyValue(JFXDialog.this.opacityProperty(), 1, Interpolator.EASE_BOTH) )) ); // reduce the number to increase the shifting , increase number to reduce shifting setCycleDuration(Duration.seconds(0.4)); setDelay(Duration.seconds(0)); } }
TopTransition() { super(contentHolder, new Timeline( new KeyFrame(Duration.ZERO, new KeyValue(contentHolder.translateYProperty(), -offsetY, Interpolator.EASE_BOTH), new KeyValue(JFXDialog.this.visibleProperty(), false, Interpolator.EASE_BOTH) ), new KeyFrame(Duration.millis(10), new KeyValue(JFXDialog.this.visibleProperty(), true, Interpolator.EASE_BOTH), new KeyValue(JFXDialog.this.opacityProperty(), 0, Interpolator.EASE_BOTH) ), new KeyFrame(Duration.millis(1000), new KeyValue(contentHolder.translateYProperty(), 0, Interpolator.EASE_BOTH), new KeyValue(JFXDialog.this.opacityProperty(), 1, Interpolator.EASE_BOTH))) ); // reduce the number to increase the shifting , increase number to reduce shifting setCycleDuration(Duration.seconds(0.4)); setDelay(Duration.seconds(0)); } }
public HorizontalTransition(boolean leftDirection, Node contentContainer, Node overlay) { super(contentContainer, new Timeline( new KeyFrame(Duration.ZERO, new KeyValue(contentContainer.translateXProperty(), (contentContainer.getLayoutX() + contentContainer.getLayoutBounds().getMaxX()) * (leftDirection? -1 : 1), Interpolator.LINEAR), new KeyValue(overlay.opacityProperty(), 0, Interpolator.EASE_BOTH) ), new KeyFrame(Duration.millis(1000), new KeyValue(overlay.opacityProperty(), 1, Interpolator.EASE_BOTH), new KeyValue(contentContainer.translateXProperty(), 0, Interpolator.EASE_OUT) ))); // reduce the number to increase the shifting , increase number to reduce shifting setCycleDuration(Duration.seconds(0.4)); setDelay(Duration.seconds(0)); } }
public VerticalTransition(boolean topDirection, Node contentContainer, Node overlay) { super(contentContainer, new Timeline( new KeyFrame(Duration.ZERO, new KeyValue(contentContainer.translateYProperty(), (contentContainer.getLayoutY() + contentContainer.getLayoutBounds().getMaxY()) * (topDirection? -1 : 1), Interpolator.LINEAR), new KeyValue(overlay.opacityProperty(), 0, Interpolator.EASE_BOTH) ), new KeyFrame(Duration.millis(1000), new KeyValue(overlay.opacityProperty(), 1, Interpolator.EASE_BOTH), new KeyValue(contentContainer.translateYProperty(), 0, Interpolator.EASE_OUT) ))); // reduce the number to increase the shifting , increase number to reduce shifting setCycleDuration(Duration.seconds(0.4)); setDelay(Duration.seconds(0)); } }
PopupTransition() { super(root, new Timeline( new KeyFrame( Duration.ZERO, new KeyValue(popupContent.opacityProperty(), 0, Interpolator.EASE_BOTH), new KeyValue(scale.xProperty(), 0, Interpolator.EASE_BOTH), new KeyValue(scale.yProperty(), 0, Interpolator.EASE_BOTH) ), new KeyFrame(Duration.millis(700), new KeyValue(scale.xProperty(), 1, Interpolator.EASE_BOTH), new KeyValue(popupContent.opacityProperty(), 0, Interpolator.EASE_BOTH) ), new KeyFrame(Duration.millis(1000), new KeyValue(popupContent.opacityProperty(), 1, Interpolator.EASE_BOTH), new KeyValue(scale.yProperty(), 1, Interpolator.EASE_BOTH) ) ) , new CacheMemento(popupContent)); setCycleDuration(Duration.seconds(.4)); setDelay(Duration.seconds(0)); }
CenterTransition() { super(contentHolder, new Timeline( new KeyFrame(Duration.ZERO, new KeyValue(contentHolder.scaleXProperty(), 0, Interpolator.EASE_BOTH), new KeyValue(contentHolder.scaleYProperty(), 0, Interpolator.EASE_BOTH), new KeyValue(JFXDialog.this.visibleProperty(), false, Interpolator.EASE_BOTH) ), new KeyFrame(Duration.millis(10), new KeyValue(JFXDialog.this.visibleProperty(), true, Interpolator.EASE_BOTH), new KeyValue(JFXDialog.this.opacityProperty(), 0, Interpolator.EASE_BOTH) ), new KeyFrame(Duration.millis(1000), new KeyValue(contentHolder.scaleXProperty(), 1, Interpolator.EASE_BOTH), new KeyValue(contentHolder.scaleYProperty(), 1, Interpolator.EASE_BOTH), new KeyValue(JFXDialog.this.opacityProperty(), 1, Interpolator.EASE_BOTH) )) ); // reduce the number to increase the shifting , increase number to reduce shifting setCycleDuration(Duration.seconds(0.4)); setDelay(Duration.seconds(0)); } }
public CenterTransition(Node contentContainer, Node overlay) { super(contentContainer, new Timeline( new KeyFrame(Duration.ZERO, new KeyValue(contentContainer.scaleXProperty(), 0, Interpolator.LINEAR), new KeyValue(contentContainer.scaleYProperty(), 0, Interpolator.LINEAR), new KeyValue(overlay.opacityProperty(), 0, Interpolator.EASE_BOTH) ), new KeyFrame(Duration.millis(1000), new KeyValue(contentContainer.scaleXProperty(), 1, Interpolator.EASE_OUT), new KeyValue(contentContainer.scaleYProperty(), 1, Interpolator.EASE_OUT), new KeyValue(overlay.opacityProperty(), 1, Interpolator.EASE_BOTH) ))); // reduce the number to increase the shifting , increase number to reduce shifting setCycleDuration(Duration.seconds(0.4)); setDelay(Duration.seconds(0)); } }