Example usage for javafx.animation StrokeTransition setAutoReverse

List of usage examples for javafx.animation StrokeTransition setAutoReverse

Introduction

In this page you can find the example usage for javafx.animation StrokeTransition setAutoReverse.

Prototype

public final void setAutoReverse(boolean value) 

Source Link

Usage

From source file:Main.java

@Override
public void start(Stage stage) {
    final Group group = new Group();
    Scene scene = new Scene(group, 300, 150);
    stage.setScene(scene);/*from ww w . ja v a2s.  c  o  m*/
    stage.setTitle("Sample");

    Rectangle rect = new Rectangle(100, 40, 100, 100);
    rect.setArcHeight(50);
    rect.setArcWidth(50);
    rect.setFill(null);

    StrokeTransition st = new StrokeTransition(Duration.millis(3000), rect, Color.RED, Color.BLUE);

    st.setAutoReverse(true);

    st.play();

    group.getChildren().add(rect);
    stage.show();
}