Java Reference
In-Depth Information
Reflection(double
offset
, double
fraction
, double
topOpacity
, double
bottomOpacity
)
Here,
offset
specifies the distance between the bottom of the image and its reflection. The
amount of the reflection that is shown is specified as a fraction, specified by
fraction
. It
must be between 0 and 1.0. The top and bottom opacity is specified by
topOpacity
and
bot-
tomOpacity
. Both must be between 0 and 1.0. A default constructor is also supplied, which
sets the offset to 0, the amount to 0.75, the top opacity to 0.5, and the bottom opacity to 0.
The offset, amount shown, and opacities can also be changed during program execution.
For example, the opacities are set using
setTopOpacity( )
and
setBottomOpacity( )
,
shown here:
final void setTopOpacity(double
opacity
)
final void setBottomOpacity(double
opacity
)
The offset is changed by calling
setTopOffset( )
:
final void setTopOffset(double
offset
)
The amount of the reflection displayed can be set by calling
setFraction( )
:
final void setFraction(double
amount
)
These methods let you adjust the reflection during program execution.
Transforms
Transforms are supported by the abstract
Transform
class, which is packaged in
javafx.scene.transform
. Four of its subclasses are
Rotate
,
Scale
,
Shear
, and
Translate
.
Each does what its name suggests. (Another subclass is
Affine
, but typically you will use
one or more of the preceding transform classes.) It is possible to perform more than one
transform on a node. For example, you could rotate and scale it. Transforms are supported
by the
Node
class as described next.
One way to add a transform to a node is to add it to the list of transforms maintained by
the node. This list is obtained by calling
getTransforms( )
, which is defined by
Node
. It is
shown here:
final ObservableList<Transform> getTransforms( )