Eclipse Calculator - JS
This JavaScript program will allow you to calculate solar eclipses, aside from also showing you what those eclipses would look like from various other planets. Follow along on this project as we explore how it works!
The Code
Lets start with looking at the JavaScript code:
-JavaScript (The Actual Code) -CSS (The Styling) -HTML (The Placement and Features)
JavaScript
Let's start with the functions (in the order of their appearance):
-Function f9 displays the about text when the instructions are clicked
-Function f10 does the opposite and closes the text when the close button is clicked,
-Function 4 opens the settings panel
-Functions 6, 7, and 8 change the color of the moon
-Function 5 closes the settings panel
-Function CalculateEclipse calculates what the magnitude of the eclipse will be according to this formula:
Magnitude = Sun Apparent Size / Moon Apparent Size
-Function drawEclipse draws the eclipse on a canvas
-Function AnimateMoon animates the moon to make it move across the "sky" (canvas)
-Function f1 checks if the user wants one of the solar system eclipse or if the user wants to calculate a custom eclipse.
-Function f2 asks for 4 values needed for calculating a custom eclipse, if it is selected.
CSS
The CSS basically comes in to parts. The first section; body { font-family: Ubuntu, Sans-Serif; margin: 0; }, tells us what font the body text should be, while the remaining half says how the header should be aligned and what's its font.
HTML
The CSS basically comes in to parts. The first section; body { font-family: Ubuntu, Sans-Serif; margin: 0; }, tells us what font the body text should be, while the remaining half says how the header should be aligned and what's its font.
Our mission
We're on a mission to change the way the housing market works. Rather than offering one service or another, we want to combine as many and make our clients' lives easy and carefree. Our goal is to match our clients with the perfect properties that fit their tastes, needs, and budgets.
Our vision
We want to live in a world where people can buy homes that match their needs rather than having to find a compromise and settle on the second-best option. That's why we take a lot of time and care in getting to know our clients from the moment they reach out to us and ask for our help.
Our team
Our strength lies in our individuality. Set up by Esther Bryce, the team strives to bring in the best talent in various fields, from architecture to interior design and sales.
Inspire
Educational content creator inspiring interest in science and spaceflight.
Contact
Subscribe To Our Newsletter
agaran@plan8studios.org
© 2024. All rights reserved.