Java Reference
In-Depth Information
KeyFrame{time:18s,values:[x=>half/2.0*3,y=>half/2.0*3,z=>50.0]}
]
}
var group = Group{
translateX: 640/2.0 - rectSize/2.0
translateY: 480/2.0 - rectSize/2.0
content:[rect1,dot2,dot1]
}
insert group into exampleGroup.content;
animation.play();
}
A rectangle is created with a
SpotLight
applied to it; the
SpotLight
has its location properties bound
to the variables
x, y, z, atX
and
atY
. This is very much like the
PointLight
example except the two new
variables
atX
and
atY
. These variables specify where the
SpotLight
is pointing. A
SpotLight
can also
specify a
z
coordinate to point at, but this example does not make use of that property. Two dots are
used to help visualize what is happening in the animation. The first dot,
dot1,
is a small circle used to
track the location of the
SpotLight
. The second dot,
dot2,
is a square that tracks where the
SpotLight
is
pointing. As the animation progresses, the square dot stays approximately in the center of the
illuminated area.
The animation moves the
SpotLight
around the point where the light is shining. Then, the point
where the light is shining is kept still, while the light itself moves about.
This animation shows how the illuminated area of a
SpotLight
is deformed as its location changes,
and as its angle to the point at which it is shining changes.
Light and Shadow Example
In the preceding examples we simply moved a light around the scene, showing how each light type
works in an animation. However, light is only half of the story when it comes to producing lifelike
animations. When a light strikes an object, the eye also notices the shadow of that object. The shadow
helps give the object a sense of volume.