diff --git a/assets/js/components.js b/assets/js/components.js index f688c4d..f99d86a 100644 --- a/assets/js/components.js +++ b/assets/js/components.js @@ -79,7 +79,7 @@ const GROUND_SPEC = { // desert-green, parasol warm, boat sail-coloured, etc. Run through the cycle // (objTone) at render time so they darken at night, warm at sunset, etc. const MATERIAL = { - oak: '#4f7d39', pine: '#356040', bush: '#5a8a44', hedge: '#4c7a3e', + oak: '#4f7d39', pine: '#356040', bush: '#2e5218', hedge: '#4c7a3e', cactus: '#5f8a4a', palm: '#4a7d3e', parasol: '#bb5a46', reed: '#74803c', boat: '#ccc4ad', }; @@ -540,19 +540,23 @@ export function ScopeReticle({ value, cat, loading, elev = 0, dt = new Date(), g // running instead of restarting (which looked like the clouds shaking). const cloudDim = isDay ? 1 : 0.55; // moonlit clouds read dimmer at night function buildCloudLayer(cov, yBand, scale, durSec, seed, key) { - if (cov == null || cov < 8) return null; - const f = Math.min(1, cov / 100); - const count = Math.round(1 + f * 3); // 1..4 sprites + // Always render the maximum 4 sprites so existing elements persist + // in the DOM and their opacity can CSS-transition instead of blinking in/out. + const maxCount = 4; + const f = cov != null ? Math.min(1, cov / 100) : 0; + const activeCount = (cov != null && cov >= 8) ? Math.round(1 + f * 3) : 0; + const baseOp = Math.min(0.9, (0.22 + f * 0.6) * cloudDim); const w = 92 * scale, hh = 48 * scale; - const op = Math.min(0.9, (0.22 + f * 0.6) * cloudDim); const imgs = []; - for (let k = 0; k < count; k++) { - const px = (seed * 47 + k * (200 / count)) % 200; + for (let k = 0; k < maxCount; k++) { + const px = (seed * 47 + k * (200 / maxCount)) % 200; const py = yBand + (((seed + k * 7) % 12) - 6); + const spriteOp = k < activeCount ? baseOp : 0; [px, px + 200].forEach((X, j) => { imgs.push(html``); }); } @@ -1006,11 +1010,11 @@ export function ScopeReticle({ value, cat, loading, elev = 0, dt = new Date(), g - - + + - ${groundStops.map((s, i) => html``)} + ${groundStops.map((s, i) => html``)} @@ -1065,7 +1069,8 @@ export function ScopeReticle({ value, cat, loading, elev = 0, dt = new Date(), g ${cloudLayers} - ${fogAlpha > 0 && html``} + ${(() => {