Animation StrokeTransition边框颜色过渡动画

  • 创建缩放动画StrokeTransition st = new StrokeTransition();

  • 设置动画持续时间st.setDuration(Duration.seconds(3));

  • 设置动画的节点st.setShape(rectangle);

  • 设置起始颜色st.setFromValue(Color.BLUE);

  • 设置终止颜色st.setToValue(Color.YELLOW);

  • 设置动画反向播放st.setAutoReverse(true);

  • 设置动画循环次数st.setCycleCount(Animation.INDEFINITE);