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 this code to have the following 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();
}
}
![Animating a Rectangle](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F57af3632-0ea4-4842-9399-c0cf9e88ecbc%2F0e6f8813-44dc-4765-b7fb-b4a0d97891b0%2Fxgcem6h_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Step by step
Solved in 2 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781305480537/9781305480537_smallCoverImage.jpg)
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781305480537/9781305480537_smallCoverImage.jpg)