Pro Java 9 Games Development Leveraging the JavaFX APIs

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

The TranslateTransition class has eleven properties, nine of which involve to, from, and by
specifications for each of the X, Y, and Z 3D coordinates. The other two are the duration property and the
node property that define the length of time of the animation and what Node object it is affecting. The byX
property is used to specify the incremental stop X coordinate double value, calculated from the start value,
for the TranslateTransition. The byY property is used to specify the incremental stop Y coordinate double
value, calculated from the start value, for the TranslateTransition. The byZ property is used to specify the
incremental stop Z coordinate double value, calculated from the start value, for the TranslateTransition.
The fromX property is used to specify a starting X coordinate double value for the TranslateTransition. The
fromY property is used to specify the starting Y coordinate double value for the TranslateTransition. A fromZ
property is used to specify a starting Z coordinate double value for a TranslateTransition. The toX property is
used to specify the stopping (resting, or final) X coordinate value for a TranslateTransition. The toY property
is used to specify a stopping (resting or final) Y coordinate value for a TranslateTransition. The toZ property
is used to specify the stopping (resting or final) Z coordinate value for the TranslateTransition object.
There are three overloaded constructor methods for TranslateTransition; one is empty, one has the
duration specified, and one has a duration and a node property specified. They look like this:


TranslateTransition()
TranslateTransition(Duration duration)
TranslateTransition(Duration duration, Node node)


There are nearly three dozen methods for use with this class, and twenty-seven of them (nine sets
of three) deal with the from, to, and by properties. This is because for each X, Y, and Z property, there is
a .get(), a .set(), and a .property() method. There are also methods for use with the duration, node, and
interpolator properties. All of the X, Y, and Z methods use double values. A .byXProperty() method is used
to specify the stop X coordinate value as an incremental offset from the start of the TranslateTransition. The
.byYProperty() method is used to specify an offset incremental stop Y coordinate value as an offset from
the start of the TranslateTransition. The .byZProperty() method is used to specify your incremental stop X
coordinate value as an offset from the start of the TranslateTransition.
The .fromXProperty() method call is used to specify a starting X coordinate value for the
TranslateTransition.
The .fromYProperty() method call is used to specify a starting Y coordinate value for the
TranslateTransition.
The .fromZProperty() method call is used to specify a starting Z coordinate value for the
TranslateTransition.
The .getByX() method call is used to get the value for the property byX. The .getByY() method call is used
to get the value for the property byY. The .getByZ() method call is used to get the value for the property byZ.
The .getFromX() method call is used to get the value for the property fromX. The .getFromY() method
call is used to get the value for the property fromY. The .getFromZ() method call is used to get the value for
the property fromZ. The .getToX() method call is used to get the value of the property toX. The .getToY()
method call is used to get the value of the property toY. The .getToZ() method call is used to get the value of
the property toZ.
The void .setByX(double value) method call is used to set (specify) the value of the property byX.
The void .setByY(double value) method call is used to set (specify) the value of the property byY. The
void .setByZ(double value) method call is used to set (specify) the value of the property byZ. The void
.setFromX(double value) method call is used to set (specify) the value of the property fromX. The void
.setFromY(double value) method call is used to set (specify) the value of the property fromY. The void
.setFromZ(double value) method call is used to set (specify) the value of the property fromZ.
The void .setToX(double value) method call is used to set (specify) the value of the property toX.
The void .setToY(double value) method call is used to set (specify) the value of the property toY. A void
.setToZ(double value) method call is used to set (specify) the value of the property toX.

Free download pdf