Java Reference
In-Depth Information
stops: [
Stop {offset: 0.0 color: Color.WHITE},
Stop {offset: 1.0 color: Color.DARKORANGE},
]
}
}
A
RadialGradient
is typically instantiated by defining a center (
x
,
y
) point and a
radius size. Like its
LinearGradient
cousin, a
RadialGradient
gives the devel-
oper the choice of either using absolute or relative coordinates as defined by the
proportional
instance variable. In the preceding case, absolute coordinates are
used where the center of the gradient appears in the upper-right quadrant of the
circle, giving the illusion of a light source shining down on the upper-right part
of a sphere. Executing the preceding code within an appropriate stage and scene
results in an image depicted in Figure 6.12.
Figure 6.12
Adding a RadialGradient to a Circle to Make It Look Like a Sphere
The ability to blur your content is available in JavaFX via the
GaussianBlur
and
MotionBlur
effects.
GaussianBlur
The
GaussianBlur
effect defines one primary instance variable,
radius
, which
is used to specify the extent of the blur in pixels. Of its many possible uses,
GaussianBlur
could serve as yet another mechanism for shadowing. Let's see
how we might use it to add a shadow to our cone image. First, create a simple tri-
angle, which is shown in Figure 6.13.
Figure 6.13
A Simple Triangle
Search WWH ::
Custom Search