Remove moon zenith (display, SVG marker, calculation)
This commit is contained in:
1 parent
c2c444e46b
commit
c263ad3dec
1 file changed
+1
-57
+1
-57
@@ -281,10 +281,7 @@
|
|||||||
<polygon points="0,-5 5,0 0,5 -5,0"/>
|
<polygon points="0,-5 5,0 0,5 -5,0"/>
|
||||||
</g>
|
</g>
|
||||||
|
|
||||||
<!-- Moon zenith marker (diamond shape, small) -->
|
<!-- Moon zenith marker removed -->
|
||||||
<g id="moon-zenith-marker" fill="#b0a89a">
|
|
||||||
<polygon points="0,-5 5,0 0,5 -5,0"/>
|
|
||||||
</g>
|
|
||||||
|
|
||||||
<!-- Sun position (rendered after arcs/arrows so it's visible) -->
|
<!-- Sun position (rendered after arcs/arrows so it's visible) -->
|
||||||
<circle id="rpg-sun-glow" cx="140" cy="140" r="14" fill="#e0914f" opacity="0.4"/>
|
<circle id="rpg-sun-glow" cx="140" cy="140" r="14" fill="#e0914f" opacity="0.4"/>
|
||||||
@@ -335,12 +332,6 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="info-content"><span class="info-label">Mond auf</span><span><span class="info-value" id="moonrise-value">--:--</span><span class="info-sub" id="moonrise-when"></span></span></div>
|
<div class="info-content"><span class="info-label">Mond auf</span><span><span class="info-value" id="moonrise-value">--:--</span><span class="info-sub" id="moonrise-when"></span></span></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="info-row">
|
|
||||||
<div class="info-icon">
|
|
||||||
<svg viewBox="0 0 24 24" fill="#b0a89a"><circle cx="12" cy="12" r="4"/><line x1="12" y1="12" x2="12" y2="3" stroke="#b0a89a" stroke-width="2"/></svg>
|
|
||||||
</div>
|
|
||||||
<div class="info-content"><span class="info-label">Zenit Mond</span><span><span class="info-value" id="moon-zenith-value">--:--</span><span class="info-sub" id="moon-zenith-when"></span></span></div>
|
|
||||||
</div>
|
|
||||||
<div class="info-row">
|
<div class="info-row">
|
||||||
<div class="info-icon">
|
<div class="info-icon">
|
||||||
<svg viewBox="0 0 24 24" fill="none" stroke="#b0a89a" stroke-width="2"><path d="M3 12 A9 9 0 0 1 21 22 Z"/></svg>
|
<svg viewBox="0 0 24 24" fill="none" stroke="#b0a89a" stroke-width="2"><path d="M3 12 A9 9 0 0 1 21 22 Z"/></svg>
|
||||||
@@ -552,7 +543,6 @@ var effect = (VANTA.CLOUDS2 || VANTA.CLOUDS)({
|
|||||||
var moonRiseArrow = document.getElementById('moon-rise-arrow');
|
var moonRiseArrow = document.getElementById('moon-rise-arrow');
|
||||||
var moonsetArrow = document.getElementById('moon-set-arrow');
|
var moonsetArrow = document.getElementById('moon-set-arrow');
|
||||||
var sunZenithMarker = document.getElementById('sun-zenith-marker');
|
var sunZenithMarker = document.getElementById('sun-zenith-marker');
|
||||||
var moonZenithMarker = document.getElementById('moon-zenith-marker');
|
|
||||||
|
|
||||||
var SUN_ORBIT_RADIUS = 65;
|
var SUN_ORBIT_RADIUS = 65;
|
||||||
var MOON_ORBIT_RADIUS = 88;
|
var MOON_ORBIT_RADIUS = 88;
|
||||||
@@ -885,33 +875,12 @@ if (moonTimes.set) {
|
|||||||
moonsetArrow.setAttribute('opacity', '0');
|
moonsetArrow.setAttribute('opacity', '0');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Moon zenith marker
|
|
||||||
if (window._moonZenithCache && window._moonZenithCache.zenith) {
|
|
||||||
var mzP = pointOnCircle(window._moonZenithCache.zenith, MOON_ORBIT_RADIUS);
|
|
||||||
moonZenithMarker.setAttribute('transform', 'translate(' + mzP.x + ', ' + mzP.y + ')');
|
|
||||||
moonZenithMarker.setAttribute('opacity', '1');
|
|
||||||
} else {
|
|
||||||
moonZenithMarker.setAttribute('opacity', '0');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Moon phase
|
// Moon phase
|
||||||
var moonIllum = SunCalc.getMoonIllumination(now);
|
var moonIllum = SunCalc.getMoonIllumination(now);
|
||||||
document.getElementById('moon-phase-text').textContent =
|
document.getElementById('moon-phase-text').textContent =
|
||||||
getMoonPhaseText(moonIllum.phase) + ' ' + Math.round(moonIllum.fraction * 100) + '%';
|
getMoonPhaseText(moonIllum.phase) + ' ' + Math.round(moonIllum.fraction * 100) + '%';
|
||||||
renderMoonPhaseIcon(moonIllum.phase, moonIllum.fraction);
|
renderMoonPhaseIcon(moonIllum.phase, moonIllum.fraction);
|
||||||
renderRpgMoon(moonIllum.phase, moonIllum.fraction);
|
renderRpgMoon(moonIllum.phase, moonIllum.fraction);
|
||||||
|
|
||||||
// Moon zenith - cache for 1 hour to save CPU
|
|
||||||
if (!window._moonZenithCache || Date.now() - window._moonZenithCache.time > 3600000) {
|
|
||||||
window._moonZenithCache = {
|
|
||||||
time: Date.now(),
|
|
||||||
zenith: findMoonZenith(now)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
var moonZenith = window._moonZenithCache.zenith;
|
|
||||||
var moonZenithWhen = moonZenith && moonZenith > now ? formatDateLong(moonZenith) : '';
|
|
||||||
document.getElementById('moon-zenith-value').textContent = moonZenith ? formatTimeHM(moonZenith) : '--:--';
|
|
||||||
document.getElementById('moon-zenith-when').textContent = moonZenithWhen ? '· ' + moonZenithWhen : '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var startTime = Date.now();
|
var startTime = Date.now();
|
||||||
@@ -1034,25 +1003,6 @@ var weatherThemes = {
|
|||||||
return (now.getTime() - startOfDay.getTime()) / 86400000;
|
return (now.getTime() - startOfDay.getTime()) / 86400000;
|
||||||
}
|
}
|
||||||
|
|
||||||
function findMoonZenith(now) {
|
|
||||||
// Sample moon altitude every 15 minutes over next 36 hours
|
|
||||||
var maxAlt = -Math.PI;
|
|
||||||
var zenith = null;
|
|
||||||
for (var i = 0; i < 144; i++) {
|
|
||||||
var sample = new Date(now.getTime() + i * 15 * 60 * 1000);
|
|
||||||
var pos = SunCalc.getMoonPosition(sample, PASSAU_LAT, PASSAU_LON);
|
|
||||||
if (pos.altitude > maxAlt) {
|
|
||||||
maxAlt = pos.altitude;
|
|
||||||
zenith = sample;
|
|
||||||
}
|
|
||||||
// Stop early if we found a peak and started rising again
|
|
||||||
if (i > 4 && zenith && pos.altitude < maxAlt - 0.1) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return zenith;
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateDebug(t, palette, vantaColors, themeName) {
|
function updateDebug(t, palette, vantaColors, themeName) {
|
||||||
var now = new Date();
|
var now = new Date();
|
||||||
var hh = now.getHours(), mm = now.getMinutes(), ss = now.getSeconds();
|
var hh = now.getHours(), mm = now.getMinutes(), ss = now.getSeconds();
|
||||||
@@ -1294,12 +1244,6 @@ var weatherThemes = {
|
|||||||
animate();
|
animate();
|
||||||
tick();
|
tick();
|
||||||
|
|
||||||
// Initial moon zenith calculation
|
|
||||||
window._moonZenithCache = {
|
|
||||||
time: Date.now(),
|
|
||||||
zenith: findMoonZenith(new Date())
|
|
||||||
};
|
|
||||||
|
|
||||||
fetchWeather();
|
fetchWeather();
|
||||||
setInterval(fetchWeather, 15 * 60 * 1000);
|
setInterval(fetchWeather, 15 * 60 * 1000);
|
||||||
tick();
|
tick();
|
||||||
|
|||||||
Reference in new issue
Block a user