帮我创建一个进度指示器,就像此链接的图像中一样: https://imagizer.imageshack.com/img924/1038/rF9o1y.png
此进度指示器不确定。
答案 0 :(得分:0)
我已经解决了我的问题,感谢@Slaw的想法。
public class AnimatedNeonCircle extends Circle {
private final RotateTransition transition;
public AnimatedNeonCircle (AnimatedNeonCircle.Animation a, double radius, double strokeWidth, Double... dashedArray) {
this.transition = new RotateTransition (a.durationProperty ().get (), AnimatedNeonCircle.this);
this.transition.setCycleCount (a.cycleCountProperty ().get ());
this.transition.setAutoReverse (a.autoReverseProperty ().get ());
this.transition.setByAngle (radius);
super.setFill (Color.TRANSPARENT);
super.setStroke (Color.CYAN);
super.setStrokeWidth (strokeWidth);
super.setEffect (new Glow (0.4));
super.setRadius (radius);
super.getStrokeDashArray ().setAll (dashedArray);
}
public void play () {
transition.play ();
}
// =======================================================================
public static class Animation {
private final SimpleObjectProperty <Duration> duration = new SimpleObjectProperty <> ();
private final SimpleIntegerProperty cycleCount = new SimpleIntegerProperty ();
private final SimpleBooleanProperty autoReverse = new SimpleBooleanProperty ();
public Animation (Duration duration, int cycleCount, boolean autoReverse) {
this.duration.set (duration);
this.cycleCount.set (cycleCount);
this.autoReverse.set (autoReverse);
}
public SimpleObjectProperty <Duration> durationProperty () { return duration; }
public SimpleIntegerProperty cycleCountProperty () { return cycleCount; }
public SimpleBooleanProperty autoReverseProperty () { return autoReverse; }
}