Example usage for javafx.animation ScaleTransition play

List of usage examples for javafx.animation ScaleTransition play

Introduction

In this page you can find the example usage for javafx.animation ScaleTransition 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 stage) {
    Group root = new Group();
    Scene scene = new Scene(root, 500, 200);
    stage.setScene(scene);/*from w w  w.ja  v a  2 s . c  o m*/

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

    ScaleTransition st = new ScaleTransition(Duration.millis(2000), rect);
    st.setByX(1.5f);
    st.setByY(1.5f);
    st.setAutoReverse(true);

    st.play();

    root.getChildren().add(rect);

    stage.show();

}