Example usage for javafx.animation StrokeTransition play

List of usage examples for javafx.animation StrokeTransition play

Introduction

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

Prototype

public void play() 

Source Link

Document

Plays Animation from current position in the direction indicated by rate .

Usage

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    Group group = new Group();

    Rectangle rect = new Rectangle(20, 20, 200, 200);

    StrokeTransition sT = new StrokeTransition(Duration.millis(2000), rect, Color.LIME, Color.YELLOW);
    sT.play();

    group.getChildren().add(rect);//from   w w w . j a v a 2s .c o  m

    Scene scene = new Scene(group, 300, 200);
    primaryStage.setScene(scene);
    primaryStage.show();
}

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   w ww . ja v a2 s.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();
}