Files
Don Cross f02658d63c More documentation fixes.
Corrected a mistake in the explanation of the
C function Astronomy_GravSimInit: the `bodyStates`
parameter is NOT barycentric -- it is relative to the
originBody parameter.

Python had improperly formatted documentation for
Time.FromTerrestrialTime parameter `tt`.

The Python markdown generator `pydown` did not
correctly handle links to compound symbols like
`#GravitySimulator.Update`. It also was trying
to link to `StateVector[]` instead of `StateVector`.

Removed unnecessary and unhelpful documentation
for C# internal class constructors. They do not appear
in the generated markdown documentation anyway.

Other minor wording revisions in the documentation.
2022-05-25 14:12:55 -04:00
..
2022-05-25 14:12:55 -04:00
2021-02-07 17:09:21 -05:00
2022-04-15 14:17:28 +04:30

JavaScript examples for the browser

You can use the JavaScript version of Astronomy Engine to perform client-side astronomy calculations in a web browser. Calculations are offloaded to the visitor's computer.

Just grab a copy of astronomy.browser.js or the minimized astronomy.browser.min.js and save it on your server. Inside your HTML code, pull in the script as usual:

<script src="astronomy.browser.js"></script>

Vanilla JS There are no external dependencies! Astronomy Engine is completely self-contained, and it always will be.

(By the way, you can use the file astronomy.js for astronomy calculations in Node.js programs.)

All the functionality is wrapped inside an object called Astronomy.

Here are some example web pages using Astronomy Engine in a web browser.


Moon Phase Calculator

Determines the Moon's current phase and predicts when the next few quarter phases will occur.

Moon Radar Pulse Round Trip Calculator

Given a location of an observer on the Earth, calculates the amount of time it takes for a radar pulse to travel from that observer to the Moon and reflect back.

Planet Positions

Calculates equatorial and horizontal coordinates of the Sun, Moon, and planets.

Rise/Set

Shows how to calculate sunrise, sunset, moonrise, and moonset times.

More JavaScript examples

The Node.js examples page has additional JavaScript examples that can be adapted to the browser environment, using the same Astronomy Engine source code.


API Reference

Complete documentation for all the functions and types available in the JavaScript version of Astronomy Engine.