Java Reference
In-Depth Information
Figure 4-6.
Light and shadow
The screenshot in Figure 4-6 shows three shapes illuminated by a
DistantLight
. A
DropShadow
is also
applied to each shape, so that the shadow is on the opposite side as the light. The code in Listing 4-5
creates an animation where the light rotates around the shapes while the shadows also rotate, always
staying on the opposite side of the light.
Listing 4-5.
Main.fx (withShadow)
function withShadow():Void{
reset();
exampleGroup.scene.fill = Color.WHITE;
var size = 140;
var elev = 45.0;
var asim = 0.0;