Java Code Examples for javafx.animation.Interpolator#EASE_BOTH

The following examples show how to use javafx.animation.Interpolator#EASE_BOTH . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GlobalTransformManager.java    From paintera with GNU General Public License v2.0 7 votes vote down vote up
public synchronized void setTransform(final AffineTransform3D affine, final Duration duration) {
	if (duration.toMillis() == 0.0) {
		setTransform(affine);
		return;
	}
	final Timeline timeline = new Timeline(60.0);
	timeline.setCycleCount(1);
	timeline.setAutoReverse(false);
	final AffineTransform3D currentState = this.affine.copy();
	final DoubleProperty progressProperty = new SimpleDoubleProperty(0.0);
	final SimilarityTransformInterpolator interpolator = new SimilarityTransformInterpolator(currentState, affine.copy());
	progressProperty.addListener((obs, oldv, newv) -> setTransform(interpolator.interpolateAt(newv.doubleValue())));
	final KeyValue kv = new KeyValue(progressProperty, 1.0, Interpolator.EASE_BOTH);
	timeline.getKeyFrames().add(new KeyFrame(duration, kv));
	timeline.play();
}
 
Example 2
Source File: Viewer3DFX.java    From paintera with GNU General Public License v2.0 6 votes vote down vote up
public void setAffine(final Affine affine, final Duration duration) {
	if (duration.toMillis() == 0.0) {
		setAffine(affine);
		return;
	}
	final Timeline timeline = new Timeline(60.0);
	timeline.setCycleCount(1);
	timeline.setAutoReverse(false);
	final Affine currentState = new Affine();
	getAffine(currentState);
	final DoubleProperty progressProperty = new SimpleDoubleProperty(0.0);
	final SimilarityTransformInterpolator interpolator = new SimilarityTransformInterpolator(
			Transforms.fromTransformFX(currentState),
			Transforms.fromTransformFX(affine)
		);
	progressProperty.addListener((obs, oldv, newv) -> setAffine(Transforms.toTransformFX(interpolator.interpolateAt(newv.doubleValue()))));
	final KeyValue kv = new KeyValue(progressProperty, 1.0, Interpolator.EASE_BOTH);
	timeline.getKeyFrames().add(new KeyFrame(duration, kv));
	timeline.play();
}
 
Example 3
Source File: VerticalTransition.java    From JFoenix with Apache License 2.0 6 votes vote down vote up
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));
}
 
Example 4
Source File: HorizontalTransition.java    From JFoenix with Apache License 2.0 6 votes vote down vote up
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));
}
 
Example 5
Source File: JFXDialog.java    From JFoenix with Apache License 2.0 6 votes vote down vote up
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));
}
 
Example 6
Source File: CenterTransition.java    From JFoenix with Apache License 2.0 6 votes vote down vote up
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));
}
 
Example 7
Source File: JFXDialog.java    From JFoenix with Apache License 2.0 6 votes vote down vote up
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));
}
 
Example 8
Source File: JFXDialog.java    From JFoenix with Apache License 2.0 6 votes vote down vote up
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));
}
 
Example 9
Source File: ChartData.java    From tilesfx with Apache License 2.0 6 votes vote down vote up
public void setDuration(final java.time.Duration DURATION) {
    if (animated) {
        oldDuration = duration;
        duration    = DURATION;
        timeline.stop();
        KeyValue kv1 = new KeyValue(currentDuration, oldDuration, Interpolator.EASE_BOTH);
        KeyValue kv2 = new KeyValue(currentDuration, DURATION, Interpolator.EASE_BOTH);
        KeyFrame kf1 = new KeyFrame(Duration.ZERO, kv1);
        KeyFrame kf2 = new KeyFrame(Duration.millis(animationDuration), kv2);
        timeline.getKeyFrames().setAll(kf1, kf2);
        timeline.play();
    } else {
        oldDuration = duration;
        duration    = DURATION;
        fireChartDataEvent(FINISHED_EVENT);
    }
}
 
Example 10
Source File: ChartData.java    From tilesfx with Apache License 2.0 6 votes vote down vote up
public void setTimestamp(final Instant TIMESTAMP) {
    if (animated) {
        oldTimestamp = timestamp;
        timestamp    = TIMESTAMP;
        timeline.stop();
        KeyValue kv1 = new KeyValue(currentTimestamp, oldTimestamp, Interpolator.EASE_BOTH);
        KeyValue kv2 = new KeyValue(currentTimestamp, TIMESTAMP, Interpolator.EASE_BOTH);
        KeyFrame kf1 = new KeyFrame(Duration.ZERO, kv1);
        KeyFrame kf2 = new KeyFrame(Duration.millis(animationDuration), kv2);
        timeline.getKeyFrames().setAll(kf1, kf2);
        timeline.play();
    } else {
        oldTimestamp = timestamp;
        timestamp    = TIMESTAMP;
        fireChartDataEvent(FINISHED_EVENT);
    }
}
 
Example 11
Source File: JFXDialog.java    From JFoenix with Apache License 2.0 6 votes vote down vote up
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));
}
 
Example 12
Source File: ValidationPane.java    From JFoenix with Apache License 2.0 5 votes vote down vote up
/**
 * 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));
}
 
Example 13
Source File: JFXSliderSkin.java    From JFoenix with Apache License 2.0 5 votes vote down vote up
private void initAnimation(Orientation orientation) {
    double thumbPos, thumbNewPos;
    DoubleProperty layoutProperty;

    if (orientation == Orientation.HORIZONTAL) {
        if (((JFXSlider) getSkinnable()).getIndicatorPosition() == IndicatorPosition.RIGHT) {
            thumbPos = thumb.getLayoutY() - thumb.getHeight();
            thumbNewPos = thumbPos - shifting;
        } else {
            double height = animatedThumb.prefHeight(animatedThumb.prefWidth(-1));
            thumbPos = thumb.getLayoutY() - height / 2;
            thumbNewPos = thumb.getLayoutY() - height - thumb.getHeight();
        }
        layoutProperty = animatedThumb.translateYProperty();
    } else {
        if (((JFXSlider) getSkinnable()).getIndicatorPosition() == IndicatorPosition.RIGHT) {
            thumbPos = thumb.getLayoutX() - thumb.getWidth();
            thumbNewPos = thumbPos - shifting;
        } else {
            double width = animatedThumb.prefWidth(-1);
            thumbPos = thumb.getLayoutX() - width / 2;
            thumbNewPos = thumb.getLayoutX() - width - thumb.getWidth();
        }
        layoutProperty = animatedThumb.translateXProperty();
    }

    clearAnimation();

    timeline = new Timeline(
        new KeyFrame(
            Duration.ZERO,
            new KeyValue(animatedThumb.scaleXProperty(), 0, Interpolator.EASE_BOTH),
            new KeyValue(animatedThumb.scaleYProperty(), 0, Interpolator.EASE_BOTH),
            new KeyValue(layoutProperty, thumbPos, Interpolator.EASE_BOTH)),
        new KeyFrame(
            Duration.seconds(0.2),
            new KeyValue(animatedThumb.scaleXProperty(), 1, Interpolator.EASE_BOTH),
            new KeyValue(animatedThumb.scaleYProperty(), 1, Interpolator.EASE_BOTH),
            new KeyValue(layoutProperty, thumbNewPos, Interpolator.EASE_BOTH)));
}
 
Example 14
Source File: JFXColorPickerSkin.java    From JFoenix with Apache License 2.0 5 votes vote down vote up
private void updateColor() {
    final ColorPicker colorPicker = (ColorPicker) getSkinnable();
    Color color = colorPicker.getValue();
    Color circleColor = color == null ? Color.WHITE : color;
    // update picker box color
    if (((JFXColorPicker) getSkinnable()).isDisableAnimation()) {
        JFXNodeUtils.updateBackground(colorBox.getBackground(), colorBox, circleColor);
    } else {
        Circle colorCircle = new Circle();
        colorCircle.setFill(circleColor);
        colorCircle.setManaged(false);
        colorCircle.setLayoutX(colorBox.getWidth() / 4);
        colorCircle.setLayoutY(colorBox.getHeight() / 2);
        colorBox.getChildren().add(colorCircle);
        Timeline animateColor = new Timeline(new KeyFrame(Duration.millis(240),
            new KeyValue(colorCircle.radiusProperty(),
                200,
                Interpolator.EASE_BOTH)));
        animateColor.setOnFinished((finish) -> {
            JFXNodeUtils.updateBackground(colorBox.getBackground(), colorBox, colorCircle.getFill());
            colorBox.getChildren().remove(colorCircle);
        });
        animateColor.play();
    }
    // update label color
    displayNode.setTextFill(circleColor.grayscale().getRed() < 0.5 ? Color.valueOf(
        "rgba(255, 255, 255, 0.87)") : Color.valueOf("rgba(0, 0, 0, 0.87)"));
    if (colorLabelVisible.get()) {
        displayNode.setText(JFXNodeUtils.colorToHex(circleColor));
    } else {
        displayNode.setText("");
    }
}
 
Example 15
Source File: JFXAlertAnimation.java    From JFoenix with Apache License 2.0 5 votes vote down vote up
@Override
public Animation createShowingAnimation(Node contentContainer, Node overlay) {
    return new CachedTransition(contentContainer, new Timeline(
        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)
        ))) {
        {
            setCycleDuration(Duration.millis(160));
            setDelay(Duration.seconds(0));
        }
    };
}
 
Example 16
Source File: ChartData.java    From OEE-Designer with MIT License 5 votes vote down vote up
public void setValue(final double VALUE) {
    if (animated) {
        timeline.stop();
        KeyValue kv1 = new KeyValue(currentValue, value, Interpolator.EASE_BOTH);
        KeyValue kv2 = new KeyValue(currentValue, VALUE, Interpolator.EASE_BOTH);
        KeyFrame kf1 = new KeyFrame(Duration.ZERO, kv1);
        KeyFrame kf2 = new KeyFrame(Duration.millis(animationDuration), kv2);
        timeline.getKeyFrames().setAll(kf1, kf2);
        timeline.play();
    } else {
        oldValue = value;
        value    = VALUE;
        fireChartDataEvent(FINISHED_EVENT);
    }
}
 
Example 17
Source File: CircularProgressIndicator.java    From mars-sim with GNU General Public License v3.0 4 votes vote down vote up
private void initGraphics() {
    double center = PREFERRED_WIDTH * 0.5;
    double radius = PREFERRED_WIDTH * 0.45;
    circle = new Circle();
    circle.setCenterX(center);
    circle.setCenterY(center);
    circle.setRadius(radius);
    circle.getStyleClass().add("indicator");
    circle.setStrokeLineCap(isRoundLineCap() ? StrokeLineCap.ROUND : StrokeLineCap.SQUARE);
    circle.setStrokeWidth(PREFERRED_WIDTH * 0.10526316);
    circle.setStrokeDashOffset(dashOffset.get());
    circle.getStrokeDashArray().setAll(dashArray_0.getValue(), 200d);

    arc = new Arc(center, center, radius, radius, 90, -360.0 * getProgress());
    arc.setStrokeLineCap(isRoundLineCap() ? StrokeLineCap.ROUND : StrokeLineCap.SQUARE);
    arc.setStrokeWidth(PREFERRED_WIDTH * 0.1);
    arc.getStyleClass().add("indicator");

    indeterminatePane = new StackPane(circle);
    indeterminatePane.setVisible(false);

    progressPane      = new Pane(arc);
    progressPane.setVisible(Double.compare(getProgress(), 0.0) != 0);

    getChildren().setAll(progressPane, indeterminatePane);

    // Setup timeline animation
    KeyValue kvDashOffset_0    = new KeyValue(dashOffset, 0, Interpolator.EASE_BOTH);
    KeyValue kvDashOffset_50   = new KeyValue(dashOffset, -32, Interpolator.EASE_BOTH);
    KeyValue kvDashOffset_100  = new KeyValue(dashOffset, -64, Interpolator.EASE_BOTH);

    KeyValue kvDashArray_0_0   = new KeyValue(dashArray_0, 5, Interpolator.EASE_BOTH);
    KeyValue kvDashArray_0_50  = new KeyValue(dashArray_0, 89, Interpolator.EASE_BOTH);
    KeyValue kvDashArray_0_100 = new KeyValue(dashArray_0, 89, Interpolator.EASE_BOTH);

    KeyValue kvRotate_0        = new KeyValue(circle.rotateProperty(), -10, Interpolator.LINEAR);
    KeyValue kvRotate_100      = new KeyValue(circle.rotateProperty(), 370, Interpolator.LINEAR);

    KeyFrame kf0               = new KeyFrame(Duration.ZERO, kvDashOffset_0, kvDashArray_0_0, kvRotate_0);
    KeyFrame kf1               = new KeyFrame(Duration.millis(1000), kvDashOffset_50, kvDashArray_0_50);
    KeyFrame kf2               = new KeyFrame(Duration.millis(1500), kvDashOffset_100, kvDashArray_0_100, kvRotate_100);

    timeline.setCycleCount(Animation.INDEFINITE);
    timeline.getKeyFrames().setAll(kf0, kf1, kf2);

    // Setup additional pane rotation
    indeterminatePaneRotation = new RotateTransition();
    indeterminatePaneRotation.setNode(indeterminatePane);
    indeterminatePaneRotation.setFromAngle(0);
    indeterminatePaneRotation.setToAngle(-360);
    indeterminatePaneRotation.setInterpolator(Interpolator.LINEAR);
    indeterminatePaneRotation.setCycleCount(Timeline.INDEFINITE);
    indeterminatePaneRotation.setDuration(new Duration(4500));
}
 
Example 18
Source File: HamburgerBackArrowBasicTransition.java    From JFoenix with Apache License 2.0 4 votes vote down vote up
private static Timeline createTimeline(JFXHamburger burger) {
    double burgerWidth = burger.getChildren().get(0).getLayoutBounds().getWidth();
    double burgerHeight = burger.getChildren().get(2).getBoundsInParent().getMaxY() - burger.getChildren()
        .get(0)
        .getBoundsInParent()
        .getMinY();

    double hypotenuse = Math.sqrt(Math.pow(burgerHeight / 2 - burger.getChildren()
                                                                  .get(0)
                                                                  .getLayoutBounds()
                                                                  .getHeight() / 2, 2) + Math.pow(burgerWidth / 2,
        2));
    double angle = Math.toDegrees(Math.asin((burgerHeight / 2 - burger.getChildren()
                                                                    .get(0)
                                                                    .getLayoutBounds()
                                                                    .getHeight() / 2) / hypotenuse));

    double burgerDiagonal = Math.sqrt(Math.pow(burger.getChildren().get(0).getLayoutBounds().getHeight(),
        2) + Math.pow(burger.getChildren()
                          .get(0)
                          .getBoundsInParent()
                          .getWidth() / 2, 2));
    double theta = (90 - angle) + Math.toDegrees(Math.atan((burger.getChildren()
                                                                .get(0)
                                                                .getLayoutBounds()
                                                                .getHeight()) / (burger.getChildren()
                                                                                     .get(0)
                                                                                     .getBoundsInParent()
                                                                                     .getWidth() / 2)));
    double hOffset = Math.cos(Math.toRadians(theta)) * burgerDiagonal / 2;
    double transY = burger.getChildren().get(0).getLayoutBounds().getHeight() / 2 + burger.getSpacing() - hOffset;
    double transX = burgerWidth / 2 - Math.sin(Math.toRadians(theta)) * (burgerDiagonal / 2);

    return new Timeline(
        new KeyFrame(
            Duration.ZERO,
            new KeyValue(burger.rotateProperty(), 0, Interpolator.EASE_BOTH),
            new KeyValue(burger.getChildren().get(0).rotateProperty(), 0, Interpolator.EASE_BOTH),
            new KeyValue(burger.getChildren().get(0).translateYProperty(), 0, Interpolator.EASE_BOTH),
            new KeyValue(burger.getChildren().get(0).translateXProperty(), 0, Interpolator.EASE_BOTH),
            new KeyValue(burger.getChildren().get(0).scaleXProperty(), 1, Interpolator.EASE_BOTH),
            new KeyValue(burger.getChildren().get(2).rotateProperty(), 0, Interpolator.EASE_BOTH),
            new KeyValue(burger.getChildren().get(2).translateYProperty(), 0, Interpolator.EASE_BOTH),
            new KeyValue(burger.getChildren().get(2).translateXProperty(), 0, Interpolator.EASE_BOTH),
            new KeyValue(burger.getChildren().get(2).scaleXProperty(), 1, Interpolator.EASE_BOTH)

        ),
        new KeyFrame(Duration.millis(1000),
            new KeyValue(burger.rotateProperty(), 0, Interpolator.EASE_BOTH),
            new KeyValue(burger.getChildren().get(0).rotateProperty(), -angle, Interpolator.EASE_BOTH),
            new KeyValue(burger.getChildren().get(0).translateYProperty(), transY, Interpolator.EASE_BOTH),
            new KeyValue(burger.getChildren().get(0).translateXProperty(), -transX, Interpolator.EASE_BOTH),
            new KeyValue(burger.getChildren().get(0).scaleXProperty(), 0.5, Interpolator.EASE_BOTH),
            new KeyValue(burger.getChildren().get(2).rotateProperty(), angle, Interpolator.EASE_BOTH),
            new KeyValue(burger.getChildren().get(2).translateYProperty(), -transY, Interpolator.EASE_BOTH),
            new KeyValue(burger.getChildren().get(2).translateXProperty(), -transX, Interpolator.EASE_BOTH),
            new KeyValue(burger.getChildren().get(2).scaleXProperty(), 0.5, Interpolator.EASE_BOTH)
        )
    );
}
 
Example 19
Source File: SlideCheckBoxSkin.java    From JFX8CustomControls with Apache License 2.0 4 votes vote down vote up
private Timeline getSelectTimeline() {
    final KeyValue kvThumbStartTranslateSelected = new KeyValue(thumb.translateXProperty(), -24, Interpolator.EASE_BOTH);
    final KeyValue kvThumbEndTranslateSelected   = new KeyValue(thumb.translateXProperty(), 24, Interpolator.EASE_BOTH);

    final KeyValue kvMarkStartOpacitySelected    = new KeyValue(markBox.opacityProperty(), 0, Interpolator.EASE_BOTH);
    final KeyValue kvMarkEndOpacitySelected      = new KeyValue(markBox.opacityProperty(), 1, Interpolator.EASE_BOTH);

    final KeyValue kvMarkStartScaleXSelected     = new KeyValue(markBox.scaleXProperty(), 0, Interpolator.EASE_BOTH);
    final KeyValue kvMarkEndScaleXSelected       = new KeyValue(markBox.scaleXProperty(), 1, Interpolator.EASE_BOTH);

    final KeyValue kvMarkStartScaleYSelected     = new KeyValue(markBox.scaleYProperty(), 0, Interpolator.EASE_BOTH);
    final KeyValue kvMarkEndScaleYSelected       = new KeyValue(markBox.scaleYProperty(), 1, Interpolator.EASE_BOTH);

    final KeyValue kvMarkStartScaleUpXSelected   = new KeyValue(markBox.scaleXProperty(), 1, Interpolator.EASE_BOTH);
    final KeyValue kvMarkEndScaleUpXSelected     = new KeyValue(markBox.scaleXProperty(), 1.5, Interpolator.EASE_BOTH);

    final KeyValue kvMarkStartScaleUpYSelected   = new KeyValue(markBox.scaleYProperty(), 1, Interpolator.EASE_BOTH);
    final KeyValue kvMarkEndScaleUpYSelected     = new KeyValue(markBox.scaleYProperty(), 1.5, Interpolator.EASE_BOTH);

    final KeyValue kvMarkStartScaleDownXSelected = new KeyValue(markBox.scaleXProperty(), 1.5, Interpolator.EASE_BOTH);
    final KeyValue kvMarkEndScaleDownXSelected   = new KeyValue(markBox.scaleXProperty(), 1, Interpolator.EASE_BOTH);

    final KeyValue kvMarkStartScaleDownYSelected = new KeyValue(markBox.scaleYProperty(), 1.5, Interpolator.EASE_BOTH);
    final KeyValue kvMarkEndScaleDownYSelected   = new KeyValue(markBox.scaleYProperty(), 1, Interpolator.EASE_BOTH);

    final KeyValue kvCrossStartOpacitySelected   = new KeyValue(crossBox.opacityProperty(), 1, Interpolator.EASE_BOTH);
    final KeyValue kvCrossEndOpacitySelected     = new KeyValue(crossBox.opacityProperty(), 0, Interpolator.EASE_BOTH);

    final KeyValue kvCrossStartScaleXSelected    = new KeyValue(crossBox.scaleXProperty(), 1, Interpolator.EASE_BOTH);
    final KeyValue kvCrossEndScaleXSelected      = new KeyValue(crossBox.scaleXProperty(), 0, Interpolator.EASE_BOTH);

    final KeyValue kvCrossStartScaleYSelected    = new KeyValue(crossBox.scaleYProperty(), 1, Interpolator.EASE_BOTH);
    final KeyValue kvCrossEndScaleYSelected      = new KeyValue(crossBox.scaleYProperty(), 0, Interpolator.EASE_BOTH);

    final KeyFrame kfStart = new KeyFrame(Duration.ZERO, kvThumbStartTranslateSelected,
                                          kvMarkStartOpacitySelected, kvMarkStartScaleXSelected, kvMarkStartScaleYSelected,
                                          kvCrossStartOpacitySelected, kvCrossStartScaleXSelected, kvCrossStartScaleYSelected);
    final KeyFrame kfEnd   = new KeyFrame(Duration.millis(180), kvThumbEndTranslateSelected,
                                          kvMarkEndOpacitySelected, kvMarkEndScaleXSelected, kvMarkEndScaleYSelected,
                                          kvCrossEndOpacitySelected, kvCrossEndScaleXSelected, kvCrossEndScaleYSelected);
    final KeyFrame kfScaleUpStart   = new KeyFrame(Duration.millis(250), kvMarkStartScaleUpXSelected, kvMarkStartScaleUpYSelected);
    final KeyFrame kfScaleUpEnd     = new KeyFrame(Duration.millis(350), kvMarkEndScaleUpXSelected, kvMarkEndScaleUpYSelected);
    final KeyFrame kfScaleDownStart = new KeyFrame(Duration.millis(350), kvMarkStartScaleDownXSelected, kvMarkStartScaleDownYSelected);
    final KeyFrame kfScaleDownEnd   = new KeyFrame(Duration.millis(500), kvMarkEndScaleDownXSelected, kvMarkEndScaleDownYSelected);

    final Timeline timeline = new Timeline();
    timeline.getKeyFrames().setAll(kfStart, kfEnd, kfScaleUpStart, kfScaleUpEnd, kfScaleDownStart, kfScaleDownEnd);
    return timeline;
}
 
Example 20
Source File: FarCry4Loading.java    From FXTutorials with MIT License 2 votes vote down vote up
public LoadingArc() {
    Arc arc = new Arc();

    arc.setCenterX(25);
    arc.setCenterY(25);
    arc.setRadiusX(25.0f);
    arc.setRadiusY(25.0f);
    arc.setLength(30.0f);
    arc.setStrokeWidth(5);

    Stop[] stops = new Stop[] { new Stop(0, Color.WHITE), new Stop(1, Color.BLUE)};
    LinearGradient lg1 = new LinearGradient(0, 0, 1, 0, true, CycleMethod.NO_CYCLE, stops);

    arc.setStroke(lg1);

    Rectangle rect = new Rectangle(50, 50);
    rect.setFill(null);
    rect.setStroke(Color.RED);

    getChildren().addAll(rect, arc);


    double time = 0.75;

    Rotate r = new Rotate(0, 25, 25);
    arc.getTransforms().add(r);
    //arc.getTransforms().add(new Scale(-1, 1, 25, 25));

    Timeline timeline = new Timeline();
    KeyFrame kf2 = new KeyFrame(Duration.seconds(time), new KeyValue(r.angleProperty(), 270));


    timeline.getKeyFrames().addAll(kf2);

    Timeline timeline3 = new Timeline(new KeyFrame(Duration.seconds(time), new KeyValue(r.angleProperty(), 360)));


    SequentialTransition st = new SequentialTransition(timeline, timeline3);
    st.setCycleCount(Timeline.INDEFINITE);
    st.setInterpolator(Interpolator.EASE_BOTH);
    st.play();

    //////////

    Timeline timeline2 = new Timeline();
    timeline2.setAutoReverse(true);
    timeline2.setCycleCount(Timeline.INDEFINITE);


    KeyFrame kf = new KeyFrame(Duration.seconds(time), new KeyValue(arc.lengthProperty(), 270, Interpolator.EASE_BOTH));

    timeline2.getKeyFrames().add(kf);
    timeline2.play();
}