Question: Implement a program that animates the solar eclipse described in the previous exercise. Omit the previous exercises slider. Exercise 19.9: Modify the texts slider-driven LunarEclipse

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));

Solar Eclipse Solar Eclipse 1 DX

Step by Step Solution

3.37 Rating (153 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Assuming youre looking to implement this in JavaFX Ill provide you a stepbystep guide on how to create a simple solar eclipse animation program withou... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Introduction To Programming With Java A Problem Solving Approach Questions!