Java Code Examples for javafx.animation.Interpolator#LINEAR
The following examples show how to use
javafx.animation.Interpolator#LINEAR .
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: JFXSpinnerSkin.java From JFoenix with Apache License 2.0 | 6 votes |
private KeyFrame[] getKeyFrames(double angle, double duration, Paint 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 + control.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 + control.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 + control.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 + control.getStartingAngle(), Interpolator.LINEAR), new KeyValue(arc.strokeProperty(), color, Interpolator.EASE_BOTH)); return frames; }
Example 2
Source File: CenterTransition.java From JFoenix with Apache License 2.0 | 6 votes |
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 3
Source File: HorizontalTransition.java From JFoenix with Apache License 2.0 | 6 votes |
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 4
Source File: VerticalTransition.java From JFoenix with Apache License 2.0 | 6 votes |
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 5
Source File: CircularProgressIndicator.java From mars-sim with GNU General Public License v3.0 | 4 votes |
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 6
Source File: CircularProgressIndicator.java From mars-sim with GNU General Public License v3.0 | 4 votes |
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 7
Source File: DockZones.java From AnchorFX with GNU Lesser General Public License v3.0 | 3 votes |
private void createRectangleForPreview() { rectanglePreview = new Rectangle(0, 0, 50, 50); rectanglePreview.getStyleClass().add("dockzone-rectangle-preview"); rectanglePreview.setOpacity(0); opacityAnimationPreview = new Timeline(new KeyFrame(Duration.seconds(0.5), new KeyValue(rectanglePreview.opacityProperty(), 0.5, Interpolator.LINEAR))); opacityAnimationPreview.setAutoReverse(true); opacityAnimationPreview.setCycleCount(-1); mainRoot.getChildren().add(rectanglePreview); }