Example usage for javafx.animation StrokeTransition StrokeTransition

List of usage examples for javafx.animation StrokeTransition StrokeTransition

Introduction

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

Prototype

public StrokeTransition(Duration duration, Shape shape, Color fromValue, Color toValue) 

Source Link

Document

The constructor of StrokeTransition

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();/*  w w  w  .j  av a  2  s  .  com*/

    group.getChildren().add(rect);

    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 w w . j  a  v a 2  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();
}