List of usage examples for javafx.scene.shape Rectangle translateXProperty
public final DoubleProperty translateXProperty()
From source file:Main.java
@Override public void start(Stage stage) { DoubleProperty translate = new SimpleDoubleProperty(); stage.setTitle("Hello JavaFX"); Rectangle node1 = RectangleBuilder.create().x(0).y(0).width(10).height(10).fill(Color.RED).build(); node1.translateXProperty().bind(translate); Parent parent = GroupBuilder.create().children(node1).translateX(250).translateY(250).build(); stage.setScene(SceneBuilder.create().width(500).height(500).root(parent).build()); stage.show();// w w w .j a va 2s .c o m TimelineBuilder.create().cycleCount(Timeline.INDEFINITE) .keyFrames(new KeyFrame(Duration.seconds(0), new KeyValue(translate, -50)), new KeyFrame(Duration.seconds(2), new KeyValue(translate, 250))) .build().play(); }