Java Code Examples for javafx.scene.paint.CycleMethod#NO_CYCLE
The following examples show how to use
javafx.scene.paint.CycleMethod#NO_CYCLE .
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: Overlay1Controller.java From examples-javafx-repos1 with Apache License 2.0 | 6 votes |
private void createTopHighlightBorder() { Stop[] stops = new Stop[] { new Stop(0, Color.WHITE), new Stop(.3, Color.LIGHTGRAY), new Stop(1, Color.TRANSPARENT) }; LinearGradient lg1 = new LinearGradient(0, 0, 0, 1, true, CycleMethod.NO_CYCLE, stops); topHighlightBorder = new Border(new BorderStroke( lg1, null, null, null, BorderStrokeStyle.SOLID, BorderStrokeStyle.NONE, BorderStrokeStyle.NONE, BorderStrokeStyle.NONE, CornerRadii.EMPTY, new BorderWidths( 8.0d ), null )); }
Example 2
Source File: SparkLineTileSkin.java From tilesfx with Apache License 2.0 | 6 votes |
private void setupGradient() { double loFactor = (low - minValue) / tile.getRange(); double hiFactor = (high - minValue) / tile.getRange(); Stop loStop = new Stop(loFactor, gradientLookup.getColorAt(loFactor)); Stop hiStop = new Stop(hiFactor, gradientLookup.getColorAt(hiFactor)); List<Stop> stopsInBetween = gradientLookup.getStopsBetween(loFactor, hiFactor); double range = hiFactor - loFactor; double factor = 1.0 / range; List<Stop> stops = new ArrayList<>(); stops.add(new Stop(0, loStop.getColor())); for (Stop stop : stopsInBetween) { stops.add(new Stop((stop.getOffset() - loFactor) * factor, stop.getColor())); } stops.add(new Stop(1, hiStop.getColor())); gradient = new LinearGradient(0, graphBounds.getY() + graphBounds.getHeight(), 0, graphBounds.getY(), false, CycleMethod.NO_CYCLE, stops); }
Example 3
Source File: AbstractStepRepresentation.java From phoenicis with GNU Lesser General Public License v3.0 | 6 votes |
protected void drawLeftImage() { AnchorPane pane = new AnchorPane(); pane.setPrefWidth(187); Stop[] stops = new Stop[] { new Stop(0, Color.web("#3c79b2")), new Stop(1, Color.web("#2d5d8b")) }; RadialGradient gradient = new RadialGradient(0, 0, 0.5, 0.5, 1, true, CycleMethod.NO_CYCLE, stops); Background background = new Background(new BackgroundFill(gradient, null, null)); pane.setBackground(background); Text text = new Text(this.parent.getLeftImageText()); text.setFill(Color.WHITE); text.setFont(Font.font("Maven Pro", 50)); text.setRotate(-90); pane.setPadding(new Insets(-50)); pane.getChildren().add(text); AnchorPane.setBottomAnchor(text, 160.0); AnchorPane.setRightAnchor(text, -40.0); getParent().getRoot().setLeft(pane); }
Example 4
Source File: ScatterChartPane.java From constellation with Apache License 2.0 | 6 votes |
public ScatterChartPane(final ScatterPlotPane parent) { this.scatterPlot = parent; final LinearGradient gradient = new LinearGradient(0.0, 0.0, 0.0, 0.75, true, CycleMethod.NO_CYCLE, new Stop[]{new Stop(0, Color.LIGHTGRAY), new Stop(1, Color.GRAY.darker())}); this.selection = new Rectangle(0, 0, 0, 0); selection.setFill(Color.WHITE); selection.setStroke(Color.BLACK); selection.setOpacity(0.4); selection.setMouseTransparent(true); selection.setStroke(Color.SILVER); selection.setStrokeWidth(2d); selection.setFill(gradient); selection.setSmooth(true); selection.setArcWidth(5.0); selection.setArcHeight(5.0); this.tooltip = new Tooltip(); this.currentData = Collections.synchronizedSet(new HashSet<>()); this.currentSelectedData = new HashSet<>(); this.getChildren().addAll(selection); this.setId("scatter-chart-pane"); this.setPadding(new Insets(5)); }
Example 5
Source File: ConversationBubble.java From constellation with Apache License 2.0 | 6 votes |
public final void setColor(final Color color) { Color bottomColor = color.darker(); Color topColor = color.brighter(); Stop[] stops = new Stop[]{ new Stop(0, topColor), new Stop(1, bottomColor) }; LinearGradient gradient = new LinearGradient(0, 0, 0, 1, true, CycleMethod.NO_CYCLE, stops); bubbleGraphic.setStroke(color); bubbleGraphic.setFill(gradient); tail.setFill(bottomColor); tail.setStroke(color); tailTop.setStroke(bottomColor); // Erase the border of the buble where the tail joins }
Example 6
Source File: SparkLineTileSkin.java From OEE-Designer with MIT License | 5 votes |
private void setupGradient() { double loFactor = (low - minValue) / tile.getRange(); double hiFactor = (high - minValue) / tile.getRange(); Stop loStop = new Stop(loFactor, gradientLookup.getColorAt(loFactor)); Stop hiStop = new Stop(hiFactor, gradientLookup.getColorAt(hiFactor)); gradient = new LinearGradient(0, graphBounds.getY() + graphBounds.getHeight(), 0, graphBounds.getY(), false, CycleMethod.NO_CYCLE, loStop, hiStop); }
Example 7
Source File: BaseLEDRepresentation.java From phoebus with Eclipse Public License 1.0 | 5 votes |
private Paint computeEditColors() { final Color[] save_colors = colors; final List<Stop> stops = new ArrayList<>(2 * save_colors.length); final double offset = 1.0 / save_colors.length; for (int i = 0; i < save_colors.length; ++i) { stops.add(new Stop(i * offset, save_colors[i])); stops.add(new Stop((i + 1) * offset, save_colors[i])); } return new LinearGradient(0, 0, 1, 1, true, CycleMethod.NO_CYCLE, stops); }
Example 8
Source File: FlipClock.java From Enzo with Apache License 2.0 | 5 votes |
@Override public void start(Stage stage) { HBox dayBox = new HBox(); dayBox.setSpacing(0); dayBox.getChildren().addAll(dayLeft, dayMid, dayRight); dayBox.setLayoutX(12); dayBox.setLayoutY(76); HBox dateBox = new HBox(); dateBox.setSpacing(0); dateBox.getChildren().addAll(dateLeft, dateRight); dateBox.setLayoutX(495); dateBox.setLayoutY(76); HBox monthBox = new HBox(); monthBox.setSpacing(0); monthBox.getChildren().addAll(monthLeft, monthMid, monthRight); monthBox.setLayoutX(833); monthBox.setLayoutY(76); HBox clockBox = new HBox(); clockBox.setSpacing(0); HBox.setMargin(hourRight, new Insets(0, 40, 0, 0)); HBox.setMargin(minRight, new Insets(0, 40, 0, 0)); clockBox.getChildren().addAll(hourLeft, hourRight, minLeft, minRight, secLeft, secRight); clockBox.setLayoutY(375); Pane pane = new Pane(dayBox, dateBox, monthBox, clockBox); pane.setPadding(new Insets(10, 10, 10, 10)); Scene scene = new Scene(pane, 1280, 800, new LinearGradient(0, 0, 0, 800, false, CycleMethod.NO_CYCLE, new Stop(0.0, Color.rgb(28, 27, 22)), new Stop(0.25, Color.rgb(38, 37, 32)), new Stop(1.0, Color.rgb(28, 27, 22)))); stage.setScene(scene); stage.show(); timer.start(); }
Example 9
Source File: SimpleHSBColorPicker.java From marathonv5 with Apache License 2.0 | 5 votes |
private LinearGradient buildHueBar() { double offset; Stop[] stops = new Stop[255]; for (int y = 0; y < 255; y++) { offset = (double) (1.0 / 255) * y; int h = (int)((y / 255.0) * 360); stops[y] = new Stop(offset, Color.hsb(h, 1.0, 1.0)); } return new LinearGradient(0f, 0f, 1f, 0f, true, CycleMethod.NO_CYCLE, stops); }
Example 10
Source File: RadialGlobalMenu.java From RadialFx with GNU Lesser General Public License v3.0 | 5 votes |
private void computeBack() { final Rectangle rect = new Rectangle(); rect.setWidth(widthProp.get()); rect.setHeight(heightProp.get()); rect.setTranslateX(widthProp.get() / -2.0); rect.setTranslateY(heightProp.get() / -2.0); final RadialGradient radialGradient = new RadialGradient(0, 0, widthProp.get() / 2.0, heightProp.get() / 2.0, widthProp.get() / 2.0, false, CycleMethod.NO_CYCLE, new Stop(0, Color.TRANSPARENT), new Stop(1, BACK_GRADIENT_COLOR)); rect.setFill(radialGradient); backContainer.getChildren().setAll(rect); }
Example 11
Source File: Cluster.java From constellation with Apache License 2.0 | 5 votes |
/** * Constructs a new <code>ClusterRectangle</code> instance. */ public ClusterRectangle() { super(0, 0, 0, 40); // Round the edges of the rectangle: setArcWidth(5.0); setArcHeight(5.0); // Make slightly transparent: setOpacity(0.65); // Set a gradient for the percentage selected: final float percentage = 1 - (float) selectedCount / (float) count; if (anyNodesSelected && percentage == 1) { setStrokeWidth(3); setStroke(Color.YELLOW.deriveColor(0, 1, 1, 0.5)); } else { setStrokeWidth(0); } // 'Blue' or unselected items represent 0% of the total: if (percentage == 0) { setFill(Color.RED.darker()); } else { final LinearGradient gradient = new LinearGradient(0.0, 0.0, 0.0, percentage, true, CycleMethod.NO_CYCLE, new Stop[]{ new Stop(percentage, Color.DODGERBLUE), new Stop(1, Color.RED.darker()) }); setFill(gradient); } }
Example 12
Source File: FuelGauge.java From medusademo with Apache License 2.0 | 5 votes |
@Override public void init() { fuelIcon = new Region(); fuelIcon.getStyleClass().setAll("fuel-icon"); gauge = GaugeBuilder.create() .skinType(SkinType.HORIZONTAL) .prefSize(500, 250) .knobColor(Color.rgb(0, 0, 0)) .foregroundBaseColor(Color.rgb(249, 249, 249)) .animated(true) .shadowsEnabled(true) .valueVisible(false) //.title("FUEL") .needleColor(Color.web("0xEF2F06")) //.needleColor(Color.rgb(255, 10, 1)) .needleShape(NeedleShape.ROUND) .needleSize(NeedleSize.THICK) .minorTickMarksVisible(false) .mediumTickMarksVisible(false) //.majorTickMarkType(TickMarkType.TRIANGLE) .sectionsVisible(true) .sections(new Section(0, 0.2, Color.rgb(255, 10, 1))) .minValue(0) .maxValue(1) .angleRange(90) .customTickLabelsEnabled(true) .customTickLabels("E", "", "", "", "", "1/2", "", "", "", "", "F") .build(); pane = new StackPane(fuelIcon, gauge); pane.setPadding(new Insets(10)); LinearGradient gradient = new LinearGradient(0, 0, 0, pane.getLayoutBounds().getHeight(), false, CycleMethod.NO_CYCLE, new Stop(0.0, Color.rgb(38, 38, 38)), new Stop(1.0, Color.rgb(15, 15, 15))); pane.setBackground(new Background(new BackgroundFill(gradient, CornerRadii.EMPTY, Insets.EMPTY))); }
Example 13
Source File: LinearGradientSample.java From marathonv5 with Apache License 2.0 | 5 votes |
public LinearGradientSample() { //First rectangle Rectangle rect1 = new Rectangle(0,0,80,80); //create simple linear gradient LinearGradient gradient1 = new LinearGradient(0, 0, 1, 0, true, CycleMethod.NO_CYCLE, new Stop[] { new Stop(0, Color.DODGERBLUE), new Stop(1, Color.BLACK) }); //set rectangle fill rect1.setFill(gradient1); // Second rectangle Rectangle rect2 = new Rectangle(0,0,80,80); //create complex linear gradient LinearGradient gradient2 = new LinearGradient(0, 0, 0, 0.5, true, CycleMethod.REFLECT, new Stop[] { new Stop(0, Color.DODGERBLUE), new Stop(0.1, Color.BLACK), new Stop(1, Color.DODGERBLUE) }); //set rectangle fill rect2.setFill(gradient2); // show the rectangles HBox hb = new HBox(10); hb.getChildren().addAll(rect1, rect2); getChildren().add(hb); }
Example 14
Source File: RadialPercentageTileSkin.java From tilesfx with Apache License 2.0 | 5 votes |
@Override protected void redraw() { super.redraw(); locale = tile.getLocale(); formatString = new StringBuilder("%.").append(Integer.toString(tile.getDecimals())).append("f").toString(); sectionsVisible = tile.getSectionsVisible(); barBackground.setStroke(tile.getBarBackgroundColor()); LinearGradient gradient = new LinearGradient(0, 0, 1, 1, true, CycleMethod.NO_CYCLE, tile.getGradientStops()); bar.setStroke(tile.isFillWithGradient() ? gradient : tile.getBarColor()); proportionBar.setStroke(tile.isFillWithGradient() ? gradient : tile.getBarColor()); percentageValueText.setFill(tile.getValueColor()); percentageUnitText.setFill(tile.getUnitColor()); descriptionText.setFill(tile.getDescriptionColor()); unitText.setFill(tile.getUnitColor()); titleText.setFill(tile.getTitleColor()); text.setFill(tile.getTextColor()); separator.setStroke(tile.getBackgroundColor()); titleText.setText(tile.getTitle()); descriptionText.setText(tile.getDescription()); text.setText(tile.getText()); unitText.setText(tile.getUnit()); referenceValue = tile.getReferenceValue() < maxValue ? maxValue : tile.getReferenceValue(); resizeStaticText(); resizeDynamicText(); }
Example 15
Source File: LedSkin.java From JFX8CustomControls with Apache License 2.0 | 4 votes |
private void resize() { size = getSkinnable().getWidth() < getSkinnable().getHeight() ? getSkinnable().getWidth() : getSkinnable().getHeight(); frameFill = new LinearGradient(0.14 * size, 0.14 * size, 0.84 * size, 0.84 * size, false, CycleMethod.NO_CYCLE, new Stop(0.0, Color.color(0.0784313725, 0.0784313725, 0.0784313725, 0.6470588235)), new Stop(0.15, Color.color(0.0784313725, 0.0784313725, 0.0784313725, 0.6470588235)), new Stop(0.26, Color.color(0.1607843137, 0.1607843137, 0.1607843137, 0.6470588235)), new Stop(0.2600001, Color.color(0.1607843137, 0.1607843137, 0.1607843137, 0.6431372549)), new Stop(0.85, Color.color(0.7843137255, 0.7843137255, 0.7843137255, 0.4039215686)), new Stop(1.0, Color.color(0.7843137255, 0.7843137255, 0.7843137255, 0.3450980392))); frame.setRadius(0.5 * size); frame.setCenterX(0.5 * size); frame.setCenterY(0.5 * size); frame.setFill(frameFill); mainOnFill = new LinearGradient(0.25 * size, 0.25 * size, 0.74 * size, 0.74 * size, false, CycleMethod.NO_CYCLE, new Stop(0.0, Color.color(0.7098039216, 0, 0, 1)), new Stop(0.49, Color.color(0.4392156863, 0, 0, 1)), new Stop(1.0, Color.color(0.9843137255, 0, 0, 1))); mainOffFill = new LinearGradient(0.25 * size, 0.25 * size, 0.74 * size, 0.74 * size, false, CycleMethod.NO_CYCLE, new Stop(0.0, Color.color(0.2039215686, 0.0588235294, 0.0784313725, 1)), new Stop(0.49, Color.color(0.1450980392, 0, 0, 1)), new Stop(1.0, Color.color(0.2039215686, 0.0588235294, 0.0784313725, 1))); innerShadow.setRadius(0.07 * size); glow.setRadius(0.36 * size); glow.setColor((Color) getSkinnable().getLedColor()); main.setRadius(0.36 * size); main.setCenterX(0.5 * size); main.setCenterY(0.5 * size); if (getSkinnable().isOn()) { main.setFill(mainOnFill); main.setEffect(glow); } else { main.setFill(mainOffFill); main.setEffect(innerShadow); } highlightFill = new RadialGradient(0, 0, 0.3 * size, 0.3 * size, 0.29 * size, false, CycleMethod.NO_CYCLE, new Stop(0.0, Color.WHITE), new Stop(1.0, Color.TRANSPARENT)); highlight.setRadius(0.29 * size); highlight.setCenterX(0.5 * size); highlight.setCenterY(0.5 * size); highlight.setFill(highlightFill); }
Example 16
Source File: SplitFlapSkin.java From Enzo with Apache License 2.0 | 4 votes |
private void refreshTextCtx() { double flapWidth = flapTextFront.getWidth(); double flapHeight = flapTextFront.getHeight(); upperTextFill = new LinearGradient(0, 0, 0, flapHeight, false, CycleMethod.NO_CYCLE, new Stop(0.0, getSkinnable().getTextColor().brighter().brighter()), new Stop(0.99, getSkinnable().getTextColor()), new Stop(1.0, getSkinnable().getTextColor().darker())); lowerTextFill = new LinearGradient(0, 0, 0, flapHeight, false, CycleMethod.NO_CYCLE, new Stop(0.0, getSkinnable().getTextColor().brighter().brighter()), new Stop(0.01, getSkinnable().getTextColor().brighter()), new Stop(1.0, getSkinnable().getTextColor())); // set the text on the upper background ctxUpperBackgroundText.clearRect(0, 0, flapWidth, flapHeight); ctxUpperBackgroundText.setFill(upperTextFill); //ctxUpperBackgroundText.fillText(selectedSet.get(nextSelectionIndex), width * 0.5, height * 0.55); ctxUpperBackgroundText.fillText(selectedSet.get(nextSelectionIndex), width * 0.5, height * 0.5); // set the text on the lower background ctxLowerBackgroundText.clearRect(0, 0, flapWidth, flapHeight); ctxLowerBackgroundText.setFill(lowerTextFill); //ctxLowerBackgroundText.fillText(selectedSet.get(currentSelectionIndex), width * 0.5, height * 0.041); ctxLowerBackgroundText.fillText(selectedSet.get(currentSelectionIndex), width * 0.5, 0); // set the text on the flap front ctxTextFront.clearRect(0, 0, flapWidth, flapHeight); ctxTextFront.setFill(upperTextFill); //ctxTextFront.fillText(selectedSet.get(currentSelectionIndex), width * 0.5, height * 0.55); ctxTextFront.fillText(selectedSet.get(currentSelectionIndex), width * 0.5, height * 0.5); // set the text on the flap back ctxTextBack.clearRect(0, 0, flapWidth, flapHeight); ctxTextBack.setFill(new LinearGradient(0, 0, 0, -flapHeight, false, CycleMethod.NO_CYCLE, new Stop(0.0, getSkinnable().getTextColor().brighter().brighter()), new Stop(0.99, getSkinnable().getTextColor().brighter()), new Stop(1.0, getSkinnable().getTextColor()))); ctxTextBack.save(); ctxTextBack.scale(1,-1); //ctxTextBack.fillText(selectedSet.get(nextSelectionIndex), width * 0.5, -height * 0.45); ctxTextBack.fillText(selectedSet.get(nextSelectionIndex), width * 0.5, -height * 0.5); ctxTextBack.restore(); }
Example 17
Source File: TimelineTileSkin.java From tilesfx with Apache License 2.0 | 4 votes |
private void setupGradient() { gradient = new LinearGradient(0, graphBounds.getY() + graphBounds.getHeight(), 0, graphBounds.getY(), false, CycleMethod.NO_CYCLE, tile.getGradientStops()); }
Example 18
Source File: Led.java From Enzo with Apache License 2.0 | 4 votes |
private void draw() { double size = getWidth() < getHeight() ? getWidth() : getHeight(); canvas.setWidth(size); canvas.setHeight(size); ctx.clearRect(0, 0, size, size); if (isFrameVisible()) { //frame Paint frame = new LinearGradient(0.14 * size, 0.14 * size, 0.84 * size, 0.84 * size, false, CycleMethod.NO_CYCLE, new Stop(0.0, Color.rgb(20, 20, 20, 0.65)), new Stop(0.15, Color.rgb(20, 20, 20, 0.65)), new Stop(0.26, Color.rgb(41, 41, 41, 0.65)), new Stop(0.26, Color.rgb(41, 41, 41, 0.64)), new Stop(0.85, Color.rgb(200, 200, 200, 0.41)), new Stop(1.0, Color.rgb(200, 200, 200, 0.35))); ctx.setFill(frame); ctx.fillOval(0, 0, size, size); } InnerShadow innerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 0.07 * size, 0, 0, 0); if (isOn()) { //on ctx.save(); Paint on = new LinearGradient(0.25 * size, 0.25 * size, 0.74 * size, 0.74 * size, false, CycleMethod.NO_CYCLE, new Stop(0.0, ledColor.get().deriveColor(0d, 1d, 0.77, 1d)), new Stop(0.49, ledColor.get().deriveColor(0d, 1d, 0.5, 1d)), new Stop(1.0, ledColor.get())); innerShadow.setInput(new DropShadow(BlurType.TWO_PASS_BOX, ledColor.get(), 0.36 * size, 0, 0, 0)); ctx.setEffect(innerShadow); ctx.setFill(on); ctx.fillOval(0.14 * size, 0.14 * size, 0.72 * size, 0.72 * size); ctx.restore(); } else { // off ctx.save(); Paint off = new LinearGradient(0.25 * size, 0.25 * size, 0.74 * size, 0.74 * size, false, CycleMethod.NO_CYCLE, new Stop(0.0, ledColor.get().deriveColor(0d, 1d, 0.20, 1d)), new Stop(0.49, ledColor.get().deriveColor(0d, 1d, 0.13, 1d)), new Stop(1.0, ledColor.get().deriveColor(0d, 1d, 0.2, 1d))); ctx.setEffect(innerShadow); ctx.setFill(off); ctx.fillOval(0.14 * size, 0.14 * size, 0.72 * size, 0.72 * size); ctx.restore(); } //highlight Paint highlight = new RadialGradient(0, 0, 0.3 * size, 0.3 * size, 0.29 * size, false, CycleMethod.NO_CYCLE, new Stop(0.0, Color.WHITE), new Stop(1.0, Color.TRANSPARENT)); ctx.setFill(highlight); ctx.fillOval(0.21 * size, 0.21 * size, 0.58 * size, 0.58 * size); }
Example 19
Source File: FXSimpleLinearGradientPicker.java From gef with Eclipse Public License 2.0 | 3 votes |
/** * Creates a simple color gradient from the given start color to the given * end color. * * @param c1 * The start {@link Color}. * @param c2 * The end {@link Color}. * @return The resulting {@link LinearGradient}. */ public static LinearGradient createSimpleLinearGradient(Color c1, Color c2) { // TODO: add angle Stop[] stops = new Stop[] { new Stop(0, c1), new Stop(1, c2) }; return new LinearGradient(0, 0, 1, 0, true, CycleMethod.NO_CYCLE, stops); }
Example 20
Source File: FarCry4Loading.java From FXTutorials with MIT License | 2 votes |
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(); }