Pro Java 9 Games Development Leveraging the JavaFX APIs

(Michael S) #1
Chapter 16 ■ 3D Game animation Creation: UsinG the animation transition Classes

Remember to double-click the Create method “createAnimationAssets()” in javafxgame.
JavaFXGame option and have NetBeans code a bootstrap method for you. You’ll be replacing the
placeholder Java code with your RotateTransition object instantiation and configuration code over the
course of this section of the chapter.
The first thing that you need to do is to declare a RotateTransition object for use at the top of
your class and name it rotGameBoard since that is what that object is going to do. Inside of your
.createAnimationAssets() method, instantiate the rotGameBoard object and configure it to play for
five seconds; then wire it to the gameBoard Group Node, as shown in the following Java 9 code and as
highlighted in light blue and yellow in Figure 16-2:


RotateTransition rotGameBoard;
...
private void createAnimationAssets() {
rotGameBoard = new RotateTransition(Duration.seconds(5), gameBoard);
}


Figure 16-1. Add a createAnimationAssets() method call at the end of the custom method call list in the
start() method

Free download pdf