Arc seems unable to draw an ordinary mathematical arc. As the attached image shows, Arc draws some strange end caps even when StrokeLineCap.BUTT and ArcType.OPEN is chosen.
This affects the latest JavaFX8 shipped with Java 8.
Code excerpt:
arc = new Arc();
arc.setType(ArcType.OPEN);
arc.setStartAngle(0);
arc.setLength(0);
timeline = new Timeline(
new KeyFrame(
Duration.ZERO,
new KeyValue(arc.startAngleProperty(), 90),
new KeyValue(arc.lengthProperty(), 0)
),
new KeyFrame(
Duration.millis(2000),
new KeyValue(arc.startAngleProperty(), 90),
new KeyValue(arc.lengthProperty(), -360)
),
new KeyFrame(
Duration.millis(4000),
new KeyValue(arc.startAngleProperty(), -270),
new KeyValue(arc.lengthProperty(), 0)
)
);
timeline.setCycleCount(Timeline.INDEFINITE);
double size = 48;
double strokeWidth = 4;
double radius = size / 2 - strokeWidth;
arc.setCenterX(radius);
arc.setCenterY(radius);
arc.setRadiusX(radius);
arc.setRadiusY(radius);
arc.setFill(null);
arc.setStroke(new Color(1.0, 1.0, 1.0, 0.9));
arc.setStrokeType(StrokeType.OUTSIDE);
arc.setStrokeWidth(strokeWidth);
arc.setStrokeLineCap(StrokeLineCap.BUTT);
NodeUtility.setOnlySize(this, radius * 2);
This affects the latest JavaFX8 shipped with Java 8.
Code excerpt:
arc = new Arc();
arc.setType(ArcType.OPEN);
arc.setStartAngle(0);
arc.setLength(0);
timeline = new Timeline(
new KeyFrame(
Duration.ZERO,
new KeyValue(arc.startAngleProperty(), 90),
new KeyValue(arc.lengthProperty(), 0)
),
new KeyFrame(
Duration.millis(2000),
new KeyValue(arc.startAngleProperty(), 90),
new KeyValue(arc.lengthProperty(), -360)
),
new KeyFrame(
Duration.millis(4000),
new KeyValue(arc.startAngleProperty(), -270),
new KeyValue(arc.lengthProperty(), 0)
)
);
timeline.setCycleCount(Timeline.INDEFINITE);
double size = 48;
double strokeWidth = 4;
double radius = size / 2 - strokeWidth;
arc.setCenterX(radius);
arc.setCenterY(radius);
arc.setRadiusX(radius);
arc.setRadiusY(radius);
arc.setFill(null);
arc.setStroke(new Color(1.0, 1.0, 1.0, 0.9));
arc.setStrokeType(StrokeType.OUTSIDE);
arc.setStrokeWidth(strokeWidth);
arc.setStrokeLineCap(StrokeLineCap.BUTT);
NodeUtility.setOnlySize(this, radius * 2);