Pro Java 9 Games Development Leveraging the JavaFX APIs

(Michael S) #1

Chapter 16 ■ 3D Game animation Creation: UsinG the animation transition Classes


Now you can start configuring this RotateTransition Animation object using the various .set()
method calls that you learned about in the previous section of the chapter. Set a Y rotation axis using
.setAxis(Rotate.Y_AXIS) and set the cycleCount property to one cycle using a .setCycleCount(1) method call.
Set the rate property to 50 percent speed using a .setRate(0.5) method call off your rotGameBoard object.
The Java statements for the core Animation object settings should look like the following Java 9 statements,
which are highlighted at the bottom of Figure 16-3:


RotateTransition rotGameBoard;
...
private void createAnimationAssets() {
rotGameBoard = new RotateTransition(Duration.seconds(5), gameBoard);
rotGameBoard.setAxis(Rotate.Y_AXIS);
rotGameBoard.setCycleCount( 1 );
rotGameBoard.setRate(0.5);
}


Figure 16-2. Declare a rotGameBoard object at the top of your class and instantiate it inside
createAnimationAssets()

Free download pdf