-
September 23, 2023 is Astronomy Day (Autumn).
We are going to see some applications on this topic, they are simply adaptations of JavaScript to App Inventor. You can create other applications about the passionate world of astronomy.
1.- Sun azimuth. Altitude.
p111_posicion_sol.aia (114.7 KB)
On this website we find a code to obtain the position of the Sun, Moon, Mars, Venus,...
https://github.com/cosinekitty/astronomy/tree/master/demo/browser
Let's adapt it to App Inventor.
The observer is in the center of the circle.
Azimuth is the angle measured from the north (top of circle) in a clockwise direction.
Altitude is the altitude angle.
Look at the modified part of the code:
let azims_altis = "";
for (let body of BodyList) {
let equ_2000 = Astronomy.Equator(body, date, observer, false, true);
let equ_ofdate = Astronomy.Equator(body, date, observer, true, true);
let hor = Astronomy.Horizon(date, observer, equ_ofdate.ra, equ_ofdate.dec, 'normal');
document.getElementById(`${body}_ra`).innerText = FormatCoord(equ_2000.ra);
document.getElementById(`${body}_dec`).innerText = FormatCoord(equ_2000.dec);
document.getElementById(`${body}_az`).innerText = FormatCoord(hor.azimuth);
document.getElementById(`${body}_alt`).innerText = FormatCoord(hor.altitude);
azims_altis = azims_altis + FormatCoord(hor.azimuth) + "," + FormatCoord(hor.altitude) + ",";
}
//alert (azims_altis);
window.AppInventor.setWebViewString("" + azims_altis);
- Proposal:
create another Ball that shows the position of the moon.