我想创建一个图表并逐个动画选定的线条。
基本上:我想要ArrayList' trans'一个接一个地播放所有元素。
int a = 0;
ArrayList<Line> nodeline = new ArrayList<Line>();
ArrayList<StrokeTransition> trans = new ArrayList<StrokeTransition>();
ArrayList<Double> lineaxisx = new ArrayList<Double>();
ArrayList<Double> lineaxisy = new ArrayList<Double>();
for(int i = 0; i < dainput.size(); i += 3) {
lineaxisx.add((double)axisx.get(dainput.get(i)));
lineaxisx.add((double)axisx.get(dainput.get(i+1)));
lineaxisy.add((double)axisy.get(dainput.get(i)));
lineaxisy.add((double)axisy.get(dainput.get(i+1)));
nodeline.add(new Line(axisx.get(dainput.get(i)),axisy.get(dainput.get(i)),axisx.get(dainput.get(i+1)),axisy.get((dainput.get(i+1)))));
nodeline.get(a).setStroke(Color.CYAN);
for(int j = 0; j < daiout.size(); j += 3){
if(daiout.get(j) == dainput.get(i) && daiout.get(j+1) == dainput.get(i + 1) && daiout.get(j + 2) == dainput.get(i + 2)){
trans.add(new StrokeTransition(Duration.millis(10000), nodeline.get(a), Color.CYAN, Color.BLUE));
}
}
root.getChildren().addAll(nodeline.get(a));
a++;
}
答案 0 :(得分:1)
SequentialTransition
完全是为了这个。你所需要的只是
SequentialTransition animation = new SequentialTransition() ;
animation.getChildren().addAll(trans);
animation.play();