Implement a program that animates the solar eclipse described in the previous exercise. Omit the previous exercises

Question:

Implement a program that animates the solar eclipse described in the previous exercise. Omit the previous exercise’s slider.

Exercise 19.9:

Modify the text’s slider-driven LunarEclipse program to make it simulate a solar eclipse. The main change will be adding a corona shape on top of the sun shape. The sun’s corona is the atmosphere surrounding the sun’s surface. Normally, one cannot view it (or the sun) directly. But during a solar eclipse, it becomes more apparent. Here’s what your resulting window should look like:

Solar Eclipse  Solar Eclipse 1 DX

Make the sun’s radius equal to 0.1 times the primary pane’s width, and put it where the LunarEclipse program’s moon was. Make the new program’s moon have the same diameter as its sun and make this moon’s vertical position match the sun’s vertical position. Use a slider to control the horizontal position of the new program’s moon. Use the following constructors for the sun, the sun’s corona, and the moon:

Circle sun = new Circle (sunx, sunY, sunR, Color.WHITE); Circle corona = new Circle( sunx, sunY, 1.3* sunR,

And use this method call to blur the sun’s corona:

corona.setEffect(new BoxBlur(sunR, sunR, 1));

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: