public StrokeTransitionSample() { super(150,150); Rectangle rect = new Rectangle(0, 0, 150, 150); rect.setArcHeight(20); rect.setArcWidth(20); rect.setFill(null); rect.setStroke(Color.DODGERBLUE); rect.setStrokeWidth(10); getChildren().add(rect); strokeTransition = StrokeTransitionBuilder.create() .duration(Duration.seconds(3)) .shape(rect) .fromValue(Color.RED) .toValue(Color.DODGERBLUE) .cycleCount(Timeline.INDEFINITE) .autoReverse(true) .build(); }