Complete the code below to have a scaling rectangle. public void start(Stage primaryStage) { // create a rectangle with width 50, height 80 and color blue ……………………………………………………………………………………………………………………………………………………………………………………………………………… // create the transition ……………………………………………………………………………………………………………………………………………………………………………………………………………… // set the duration of the transition as 5 seconds ……………………………………………………………………………………………………………………………………………………………………………………………………………… // make the rectangle as the node for the transition ……………………………………………………………………………………………………………………………………………………………………………………………………………… // transition to double the size of x ……………………………………………………………………………………………………………………………………………………………………………………………………………… // transition to double the size of y ……………………………………………………………………………………………………………………………………………………………………………………………………………… // set the cycle count as 2 ……………………………………………………………………………………………………………………………………………………………………………………………………………… // set it so the transition will reverse ……………………………………………………………………………………………………………………………………………………………………………………………………………… // play the transition ……………………………………………………………………………………………………………………………………………………………………………………………………………… StackPane root = new StackPane(); root.getChildren().add(rectangle); Scene scene = new Scene(root, 300, 250); primaryStage.setTitle("Animating a Rectangle"); primaryStage.setScene(scene); primaryStage.show(); }
Complete the code below to have a scaling rectangle.
public void start(Stage primaryStage) {
// create a rectangle with width 50, height 80 and color blue
………………………………………………………………………………………………………………………………………………………………………………………………………………
// create the transition
………………………………………………………………………………………………………………………………………………………………………………………………………………
// set the duration of the transition as 5 seconds
………………………………………………………………………………………………………………………………………………………………………………………………………………
// make the rectangle as the node for the transition
………………………………………………………………………………………………………………………………………………………………………………………………………………
// transition to double the size of x
………………………………………………………………………………………………………………………………………………………………………………………………………………
// transition to double the size of y
………………………………………………………………………………………………………………………………………………………………………………………………………………
// set the cycle count as 2
………………………………………………………………………………………………………………………………………………………………………………………………………………
// set it so the transition will reverse
………………………………………………………………………………………………………………………………………………………………………………………………………………
// play the transition
………………………………………………………………………………………………………………………………………………………………………………………………………………
StackPane root = new StackPane();
root.getChildren().add(rectangle);
Scene scene = new Scene(root, 300, 250);
primaryStage.setTitle("Animating a Rectangle");
primaryStage.setScene(scene);
primaryStage.show();
}
}
Step by step
Solved in 2 steps