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; }; }
public void togglePane() { if (toggleAnimation == null) { updateToggleAnimation(); } this.getClip().scaleXProperty().unbind(); this.getClip().scaleYProperty().unbind(); toggleAnimation.setRate(toggleAnimation.getRate() * -1); if (toggleAnimation.getCurrentTime().equals(Duration.millis(0)) && toggleAnimation.getRate() == -1) { toggleAnimation.playFrom(Duration.millis(510)); } else { toggleAnimation.play(); } }
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)); } }
CheckBoxTransition(Node mark) { super(null, new Timeline( new KeyFrame( Duration.ZERO, new KeyValue(mark.opacityProperty(), 0, Interpolator.EASE_OUT), new KeyValue(mark.scaleXProperty(), 0.5, Interpolator.EASE_OUT), new KeyValue(mark.scaleYProperty(), 0.5, Interpolator.EASE_OUT) ), new KeyFrame(Duration.millis(400), new KeyValue(mark.opacityProperty(), 1, Interpolator.EASE_OUT), new KeyValue(mark.scaleXProperty(), 0.5, Interpolator.EASE_OUT), new KeyValue(mark.scaleYProperty(), 0.5, Interpolator.EASE_OUT) ), new KeyFrame( Duration.millis(1000), new KeyValue(mark.scaleXProperty(), 1, Interpolator.EASE_OUT), new KeyValue(mark.scaleYProperty(), 1, Interpolator.EASE_OUT) ) ) ); // reduce the number to increase the shifting , increase number to reduce shifting setCycleDuration(Duration.seconds(0.12)); setDelay(Duration.seconds(0.05)); this.mark = mark; }
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 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)), }, this.widthProperty(), this.heightProperty())); this.getClip().scaleYProperty().bind(Bindings.createDoubleBinding(() -> { double X = this.getWidth() / getClip().getLayoutBounds().getWidth(); double Y = this.getHeight() / getClip().getLayoutBounds().getHeight();
frames.add(new KeyFrame(duration, new KeyValue(container.getChildren().get(1).scaleXProperty(), expanded ? 1 : 0, Interpolator.EASE_BOTH), new KeyValue(container.getChildren().get(1).scaleYProperty(), expanded ? 1 : 0, Interpolator.EASE_BOTH) )); frames.add(new KeyFrame(Duration.millis(duration.toMillis()),
Timeline timeline = new Timeline(new KeyFrame(Duration.millis(2500)), new KeyFrame(Duration.millis(0), new KeyValue(node.scaleXProperty(), 1, EASE_BOTH), new KeyValue(node.scaleYProperty(), 1, EASE_BOTH), new KeyValue(node.rotateProperty(), 0, EASE_BOTH)), new KeyFrame(Duration.millis(100), new KeyValue(node.scaleXProperty(), 0.9, EASE_BOTH), new KeyValue(node.scaleYProperty(), 0.9, EASE_BOTH), new KeyValue(node.rotateProperty(), -3, EASE_BOTH)), new KeyFrame(Duration.millis(200), new KeyValue(node.scaleXProperty(), 0.9, EASE_BOTH), new KeyValue(node.scaleYProperty(), 0.9, EASE_BOTH), new KeyValue(node.rotateProperty(), -3, EASE_BOTH)), new KeyFrame(Duration.millis(300), new KeyValue(node.scaleXProperty(), 1.1, EASE_BOTH), new KeyValue(node.scaleYProperty(), 1.1, EASE_BOTH), new KeyValue(node.rotateProperty(), 3, EASE_BOTH)), new KeyFrame(Duration.millis(400), new KeyValue(node.scaleXProperty(), 1.1, EASE_BOTH), new KeyValue(node.scaleYProperty(), 1.1, EASE_BOTH), new KeyValue(node.rotateProperty(), -3, EASE_BOTH)), new KeyFrame(Duration.millis(500), new KeyValue(node.scaleXProperty(), 1.1, EASE_BOTH), new KeyValue(node.scaleYProperty(), 1.1, EASE_BOTH), new KeyValue(node.rotateProperty(), 3, EASE_BOTH)), new KeyFrame(Duration.millis(600), new KeyValue(node.scaleXProperty(), 1.1, EASE_BOTH), new KeyValue(node.scaleYProperty(), 1.1, EASE_BOTH), new KeyValue(node.rotateProperty(), -3, EASE_BOTH)), new KeyFrame(Duration.millis(700), new KeyValue(node.scaleXProperty(), 1.1, EASE_BOTH), new KeyValue(node.scaleYProperty(), 1.1, EASE_BOTH), new KeyValue(node.rotateProperty(), 3, EASE_BOTH)), new KeyFrame(Duration.millis(800), new KeyValue(node.scaleXProperty(), 1.1, EASE_BOTH), new KeyValue(node.scaleYProperty(), 1.1, EASE_BOTH), new KeyValue(node.rotateProperty(), -3, EASE_BOTH)), new KeyFrame(Duration.millis(900), new KeyValue(node.scaleXProperty(), 1.1, EASE_BOTH),
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; }; }
new KeyFrame(Duration.millis(200), new KeyValue(node.translateYProperty(), node.getTranslateY() - f * dy)), new KeyFrame(Duration.millis(200), new KeyValue(node.scaleXProperty(), scale)), new KeyFrame(Duration.millis(200), new KeyValue(node.scaleYProperty(), scale)) ); timeline.play();
public void togglePane() { if (toggleAnimation == null) { updateToggleAnimation(); } this.getClip().scaleXProperty().unbind(); this.getClip().scaleYProperty().unbind(); toggleAnimation.setRate(toggleAnimation.getRate() * -1); if (toggleAnimation.getCurrentTime().equals(Duration.millis(0)) && toggleAnimation.getRate() == -1) { toggleAnimation.playFrom(Duration.millis(510)); } else { toggleAnimation.play(); } }
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)); } }
CheckBoxTransition(Node mark) { super(null, new Timeline( new KeyFrame( Duration.ZERO, new KeyValue(mark.opacityProperty(), 0, Interpolator.EASE_OUT), new KeyValue(mark.scaleXProperty(), 0.5, Interpolator.EASE_OUT), new KeyValue(mark.scaleYProperty(), 0.5, Interpolator.EASE_OUT) ), new KeyFrame(Duration.millis(400), new KeyValue(mark.opacityProperty(), 1, Interpolator.EASE_OUT), new KeyValue(mark.scaleXProperty(), 0.5, Interpolator.EASE_OUT), new KeyValue(mark.scaleYProperty(), 0.5, Interpolator.EASE_OUT) ), new KeyFrame( Duration.millis(1000), new KeyValue(mark.scaleXProperty(), 1, Interpolator.EASE_OUT), new KeyValue(mark.scaleYProperty(), 1, Interpolator.EASE_OUT) ) ) ); // reduce the number to increase the shifting , increase number to reduce shifting setCycleDuration(Duration.seconds(0.12)); setDelay(Duration.seconds(0.05)); this.mark = mark; }
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 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)), }, this.widthProperty(), this.heightProperty())); this.getClip().scaleYProperty().bind(Bindings.createDoubleBinding(() -> { double X = this.getWidth() / getClip().getLayoutBounds().getWidth(); double Y = this.getHeight() / getClip().getLayoutBounds().getHeight();