Java Reference
In-Depth Information
To start the animation, the
Sun
,
Moon
, and
BlueSky
are visible with the
Moon
left
and lower from the
Sun
. The
Moon
starts moving along a linear path that intersects
with the
Sun
. Figure 7.9 shows the
Moon
partially covering the
Sun
. The
Moon
's
movement is done by transitioning the
Moon
's
translateX
and
translateY
instance variables along a linear path.
Figure 7.9
Solar Eclipse, Moon Intersecting with Sun
As the
Moon
nears totality, the
DarkSky
with stars begins to appear along with a
SunBurst
at the upper right
,
the so-called diamond ring effect. This is done by
transitioning the
opacity
for the
BlueSky
to zero, while transitioning the
opacity
for the
DarkSky
and
SunBurst
to 1.0. This is shown in Figure 7.10.
Search WWH ::
Custom Search