List of usage examples for javafx.animation TranslateTransition setByX
public final void setByX(double value)
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setTitle("Sample"); stage.setWidth(300);//w ww. j av a2 s. c om stage.setHeight(190); VBox vbox = new VBox(); vbox.setLayoutX(20); vbox.setLayoutY(20); Rectangle rect = new Rectangle(100, 40, 100, 100); rect.setArcHeight(50); rect.setArcWidth(50); rect.setFill(Color.VIOLET); TranslateTransition tt = new TranslateTransition(Duration.millis(2000), rect); tt.setByX(200f); tt.setAutoReverse(true); tt.play(); vbox.getChildren().add(rect); vbox.setSpacing(10); ((Group) scene.getRoot()).getChildren().add(vbox); stage.setScene(scene); stage.show(); }