From bfdb76b496c959c59c708213177ec13266a6bddc Mon Sep 17 00:00:00 2001 From: Ekaropolus Date: Sun, 4 Jan 2026 00:36:19 -0600 Subject: [PATCH] Steward Aura --- .../pxy_simulations/simulation_mvp.html | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/pxy_simulations/templates/pxy_simulations/simulation_mvp.html b/pxy_simulations/templates/pxy_simulations/simulation_mvp.html index 4a0ac5c..0f58741 100644 --- a/pxy_simulations/templates/pxy_simulations/simulation_mvp.html +++ b/pxy_simulations/templates/pxy_simulations/simulation_mvp.html @@ -220,6 +220,10 @@ let busy = false; let lastState = null; let gridCenter = { lat: 19.4326, lon: -99.1332 }; + let stewardAura = null; + const auraStart = Cesium.JulianDate.now(); + const auraBaseMeters = 260.0; + const auraPulseMeters = 120.0; const R = 6378137; const GRID_METERS_PER_UNIT = 10.0; @@ -228,6 +232,40 @@ statusEl.textContent = text; } + function updateStewardAura() { + const lat = Number(inputLat.value); + const lon = Number(inputLon.value); + if (!Number.isFinite(lat) || !Number.isFinite(lon)) { + return; + } + if (stewardAura) { + viewer.entities.remove(stewardAura); + } + const radiusProp = new Cesium.CallbackProperty((time) => { + const t = Cesium.JulianDate.secondsDifference(time, auraStart); + const pulse = (Math.sin((t * 2 * Math.PI) / 4) + 1) / 2; + return auraBaseMeters + auraPulseMeters * pulse; + }, false); + const colorProp = new Cesium.CallbackProperty((time) => { + const t = Cesium.JulianDate.secondsDifference(time, auraStart); + const pulse = (Math.sin((t * 2 * Math.PI) / 4) + 1) / 2; + return Cesium.Color.fromCssColorString("#36f1ff").withAlpha(0.18 + 0.18 * pulse); + }, false); + stewardAura = viewer.entities.add({ + name: "Steward Aura", + position: Cesium.Cartesian3.fromDegrees(lon, lat, 0), + ellipse: { + semiMajorAxis: radiusProp, + semiMinorAxis: radiusProp, + heightReference: Cesium.HeightReference.CLAMP_TO_GROUND, + material: new Cesium.ColorMaterialProperty(colorProp), + outline: true, + outlineColor: Cesium.Color.fromCssColorString("#8affff").withAlpha(0.7), + outlineWidth: 2, + }, + }); + } + function applyQueryParams() { const params = new URLSearchParams(window.location.search); const lat = params.get("lat"); @@ -247,6 +285,8 @@ if (speed) inputSpeed.value = speed; if (radius) inputRadius.value = radius; + updateStewardAura(); + if (auto === "1") { setTimeout(() => { btnNew.click(); @@ -394,6 +434,7 @@ lat: Number(inputLat.value) || 19.4326, lon: Number(inputLon.value) || -99.1332, }; + updateStewardAura(); const payload = { residents: inputResidents.value, services: inputServices.value,