Question: What would be the correct output for this JAVA code? ( please screenshot the result ) The Code: import javafx.animation.ParallelTransition; import javafx.animation.TranslateTransition; import javafx.animation.ScaleTransition; import
What would be the correct output for this JAVA code? please screenshot the result The Code: import javafx.animation.ParallelTransition;
import javafx.animation.TranslateTransition;
import javafx.animation.ScaleTransition;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.stage.Stage;
import javafx.util.Duration;
public class ShapeAnimation extends Application
@Override
public void startStage primaryStage
Create a rectangle shape
Rectangle rectangle new Rectangle;
rectangle.setFillColorBLUE;
Create a translation animation for the rectangle
TranslateTransition translate new TranslateTransitionDurationseconds rectangle;
translate.setByX; Move by pixels horizontally
translate.setCycleCountTranslateTransitionINDEFINITE;
translate.setAutoReversetrue;
Create a scaling animation for the rectangle
ScaleTransition scale new ScaleTransitionDurationseconds rectangle;
scale.setByX; Scale horizontally by
scale.setByY; Scale vertically by
scale.setCycleCountScaleTransitionINDEFINITE;
scale.setAutoReversetrue;
Create a ParallelTransition and add both animations
ParallelTransition parallelTransition new ParallelTransition;
parallelTransition.getChildrenaddAlltranslate scale;
Play the parallel animation
parallelTransition.play;
Create a pane and add the rectangle to it
Pane root new Panerectangle;
Set the scene
Scene scene new Sceneroot;
primaryStage.setScenescene;
primaryStage.setTitleShape Animation";
primaryStage.show;
public static void mainString args
launchargs;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
