Shortwave Phosphor Tuner
Deep phosphor-black CRT radar reticle, emerald scanlines, analog frequency dial, and live world-station signal lock.
Inspired by Radio Garden ↗
WHY THIS AESTHETIC IS UNIQUE
Merges shortwave radio nostalgia with precision radar telemetry, letting visitors tune frequencies across cities with animated reticle lock and phosphor waveforms.
BEST FOR
TAGS
COLOR PALETTE (CLICK TO COPY HEX)
TYPOGRAPHY
- Display
- Share Tech Mono
- Body
- JetBrains Mono
- Mono
- Share Tech Mono
- Scale
- Monospaced frequency readouts (kHz/MHz) in glowing phosphor green with tabular latitude/longitude coordinates and signal dB meters.
ARCHITECTURE & MOBILE NOTES
LAYOUT
Centered circular azimuth radar reticle with subtle CRT scanline overlay, flanked by a precision frequency tuning slider, live signal-strength waveform, and city station presets.
INTERACTION
Interactive frequency slider and global station presets (Reykjavik, Tokyo, Buenos Aires, Cairo, Zurich) that sweep the radar coordinates, animate signal lock strength, and modulate the live phosphor waveform.
MOBILE
Stacks the circular radar scope above a full-width thumb-friendly tuning slider and >=44px station preset buttons on 390px viewports.
AI AGENT GUARDRAILS
DO
- Layer subtle low-opacity horizontal CRT scanlines over deep green-black phosphor surfaces.
- Use crisp vector concentric rings, crosshairs, and coordinate telemetry.
- Provide immediate visual signal-lock feedback as the user tunes across frequencies.
DON'T
- Never make scanlines or glow effects so heavy that frequency labels lose readability.
- Avoid generic purple/blue sci-fi tropes; keep the palette authentically emerald phosphor.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>SW-8800 — Shortwave Phosphor Radar Tuner</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600;700&family=Orbitron:wght@500;700&display=swap" rel="stylesheet">
<style>
:root {
--bg: #040806;
--panel: #08120c;
--panel-hi: #0d1d14;
--phosphor: #46ff96;
--phosphor-dim: #1b663d;
--amber: #ffba49;
--alert: #ff5d52;
--border: #1e4d33;
--mono: 'JetBrains Mono', 'Courier New', monospace;
--display: 'Orbitron', 'Courier New', monospace;
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html, body {
min-height: 100%;
width: 100%;
overflow-x: hidden;
background: radial-gradient(circle at 50% 15%, #0c1d13 0%, #040806 72%);
color: var(--phosphor);
font-family: var(--mono);
}
/* Subtle CRT scanline overlay */
body::after {
content: "";
position: fixed;
inset: 0;
pointer-events: none;
z-index: 900;
background: repeating-linear-gradient(
to bottom,
rgba(0, 0, 0, 0) 0px,
rgba(0, 0, 0, 0) 2px,
rgba(0, 0, 0, 0.22) 3px,
rgba(0, 0, 0, 0.22) 4px
);
}
.shell {
width: 100%;
max-width: 1080px;
margin: 0 auto;
padding: 14px 10px 36px;
display: flex;
flex-direction: column;
gap: 14px;
}
/* Top Telemetry Header */
.topbar {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
gap: 8px;
padding: 10px 12px;
background: var(--panel);
border: 1.5px solid var(--border);
box-shadow: 0 0 22px rgba(70, 255, 150, 0.08);
}
.brand {
display: flex;
align-items: center;
gap: 10px;
}
.pulse-led {
width: 10px;
height: 10px;
border-radius: 50%;
background: var(--phosphor);
box-shadow: 0 0 10px var(--phosphor);
animation: blink 2s ease-in-out infinite;
}
@keyframes blink {
0%, 100% { opacity: 1; }
50% { opacity: 0.4; }
}
.brand h1 {
font-family: var(--display);
font-size: 14px;
letter-spacing: 0.12em;
text-shadow: 0 0 10px rgba(70, 255, 150, 0.45);
}
.utc-readout {
font-size: 12px;
color: var(--amber);
letter-spacing: 0.08em;
}
/* Main Grid */
.console-grid {
display: grid;
grid-template-columns: 1fr;
gap: 14px;
}
.crt-card {
background: var(--panel);
border: 1.5px solid var(--border);
padding: 12px;
display: flex;
flex-direction: column;
gap: 12px;
box-shadow: inset 0 0 28px rgba(0, 0, 0, 0.85), 0 0 18px rgba(70, 255, 150, 0.06);
}
.card-head {
display: flex;
justify-content: space-between;
align-items: center;
gap: 8px;
font-size: 11px;
letter-spacing: 0.12em;
text-transform: uppercase;
color: #87cfa6;
border-bottom: 1px solid var(--border);
padding-bottom: 8px;
}
/* Radar Reticle */
.radar-stage {
position: relative;
width: 100%;
max-width: 380px;
margin: 0 auto;
aspect-ratio: 1 / 1;
}
#radar-canvas {
display: block;
width: 100%;
height: 100%;
border-radius: 50%;
border: 2px solid var(--border);
background: radial-gradient(circle, #0b1c12 0%, #040a06 78%);
box-shadow: 0 0 28px rgba(70, 255, 150, 0.14), inset 0 0 24px rgba(0, 0, 0, 0.9);
cursor: crosshair;
touch-action: manipulation;
}
.coord-strip {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 6px;
text-align: center;
}
.coord-cell {
padding: 7px 6px;
background: #050c08;
border: 1px solid var(--border);
}
.coord-cell span {
display: block;
font-size: 10px;
color: #74b28f;
margin-bottom: 2px;
}
.coord-cell strong {
font-size: 12px;
color: var(--phosphor);
}
/* Frequency Display */
.freq-box {
background: #040906;
border: 1.5px solid var(--border);
padding: 12px;
display: flex;
flex-direction: column;
gap: 8px;
}
.freq-top {
display: flex;
justify-content: space-between;
align-items: baseline;
gap: 8px;
flex-wrap: wrap;
}
.freq-digits {
font-family: var(--display);
font-size: 32px;
letter-spacing: 0.06em;
color: var(--phosphor);
text-shadow: 0 0 14px rgba(70, 255, 150, 0.65);
line-height: 1.1;
}
.freq-unit {
font-size: 14px;
color: var(--amber);
margin-left: 4px;
}
.lock-badge {
padding: 4px 8px;
border: 1px solid var(--phosphor);
font-size: 11px;
letter-spacing: 0.1em;
color: var(--phosphor);
background: rgba(70, 255, 150, 0.1);
}
.lock-badge.searching {
border-color: var(--amber);
color: var(--amber);
background: rgba(255, 186, 73, 0.08);
}
.station-meta {
display: flex;
justify-content: space-between;
align-items: center;
gap: 8px;
flex-wrap: wrap;
font-size: 12px;
color: #b7f5d2;
}
/* Tuning Controls */
.tuner-slider-wrap {
display: flex;
flex-direction: column;
gap: 8px;
}
.freq-range {
width: 100%;
-webkit-appearance: none;
appearance: none;
height: 14px;
background: #06120b;
border: 1px solid var(--border);
border-radius: 2px;
outline: none;
cursor: pointer;
}
.freq-range::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 24px;
height: 28px;
background: var(--phosphor);
border: 2px solid #040806;
box-shadow: 0 0 12px rgba(70, 255, 150, 0.7);
cursor: pointer;
}
.scale-ticks {
display: flex;
justify-content: space-between;
font-size: 10px;
color: #6ca886;
}
.fine-controls {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 6px;
}
.crt-btn {
min-height: 44px;
padding: 8px 6px;
background: var(--panel-hi);
border: 1.5px solid var(--border);
color: var(--phosphor);
font-family: var(--mono);
font-size: 12px;
font-weight: 600;
cursor: pointer;
transition: background 0.12s ease, border-color 0.12s ease;
}
.crt-btn:hover, .crt-btn:focus-visible {
border-color: var(--phosphor);
background: rgba(70, 255, 150, 0.14);
outline: none;
}
.crt-btn.active {
background: var(--phosphor);
color: #040806;
border-color: var(--phosphor);
box-shadow: 0 0 12px rgba(70, 255, 150, 0.45);
}
/* Signal Strength Meter */
.meter-wrap {
display: flex;
flex-direction: column;
gap: 6px;
}
.meter-head {
display: flex;
justify-content: space-between;
font-size: 11px;
color: #87cfa6;
}
.s-meter {
display: grid;
grid-template-columns: repeat(12, 1fr);
gap: 4px;
}
.s-seg {
height: 16px;
background: #0a1b11;
border: 1px solid #183d28;
transition: background 0.12s ease, box-shadow 0.12s ease;
}
.s-seg.on {
background: var(--phosphor);
box-shadow: 0 0 8px rgba(70, 255, 150, 0.65);
}
.s-seg.on.amber {
background: var(--amber);
box-shadow: 0 0 8px rgba(255, 186, 73, 0.65);
}
.s-seg.on.hot {
background: var(--alert);
box-shadow: 0 0 8px rgba(255, 93, 82, 0.65);
}
/* Phosphor Waveform */
.scope-frame {
background: #030805;
border: 1.5px solid var(--border);
padding: 4px;
}
#wave-canvas {
display: block;
width: 100%;
height: 92px;
}
/* Station Presets */
.preset-grid {
display: grid;
grid-template-columns: 1fr;
gap: 8px;
}
.preset-card {
min-height: 52px;
padding: 9px 10px;
background: #06100a;
border: 1.5px solid var(--border);
color: var(--phosphor);
font-family: var(--mono);
cursor: pointer;
display: flex;
justify-content: space-between;
align-items: center;
gap: 10px;
text-align: left;
}
.preset-card:hover {
border-color: var(--phosphor);
background: #0c2115;
}
.preset-card.locked {
background: rgba(70, 255, 150, 0.14);
border-color: var(--phosphor);
box-shadow: inset 3px 0 0 var(--phosphor);
}
.preset-city {
font-weight: 700;
font-size: 13px;
display: block;
}
.preset-call {
font-size: 11px;
color: #87cfa6;
}
.preset-freq {
font-family: var(--display);
font-size: 13px;
color: var(--amber);
flex-shrink: 0;
}
@media (min-width: 820px) {
.shell {
padding: 20px 20px 44px;
}
.console-grid {
grid-template-columns: 1fr 1.15fr;
align-items: start;
}
.preset-grid {
grid-template-columns: repeat(2, 1fr);
}
}
</style>
</head>
<body>
<main class="shell">
<header class="topbar">
<div class="brand">
<span class="pulse-led" aria-hidden="true"></span>
<h1>SW-8800 // PHOSPHOR RADAR TUNER</h1>
</div>
<div class="utc-readout" id="utc-clock">UTC 00:00:00 Z</div>
</header>
<section class="console-grid">
<!-- LEFT: AZIMUTH RADAR RETICLE -->
<article class="crt-card" aria-label="Azimuth Shortwave Globe Radar">
<div class="card-head">
<span>Azimuth Bearing Reticle</span>
<span id="radar-hint">Tap blip to lock</span>
</div>
<div class="radar-stage">
<canvas id="radar-canvas" width="380" height="380"></canvas>
</div>
<div class="coord-strip">
<div class="coord-cell">
<span>LATITUDE</span>
<strong id="coord-lat">64.15° N</strong>
</div>
<div class="coord-cell">
<span>LONGITUDE</span>
<strong id="coord-lon">21.94° W</strong>
</div>
<div class="coord-cell">
<span>AZIMUTH</span>
<strong id="coord-az">342° NNW</strong>
</div>
</div>
</article>
<!-- RIGHT: FREQUENCY TUNER, S-METER, WAVEFORM, PRESETS -->
<article class="crt-card" aria-label="Frequency Controls and Station Presets">
<div class="card-head">
<span>HF Shortwave Receiver</span>
<span id="prop-band">IONOSPHERE: F2 LAYER</span>
</div>
<div class="freq-box">
<div class="freq-top">
<div>
<span class="freq-digits" id="freq-display">06.185</span>
<span class="freq-unit">MHz</span>
</div>
<span class="lock-badge" id="lock-badge">CARRIER LOCKED</span>
</div>
<div class="station-meta">
<strong id="station-name">Reykjavik — RUV North Atlantic</strong>
<span id="station-prog">Weather & Maritime Bulletin</span>
</div>
</div>
<div class="tuner-slider-wrap">
<input class="freq-range" type="range" id="freq-slider" min="3.00" max="22.00" step="0.005" value="6.185" aria-label="Shortwave frequency in megahertz">
<div class="scale-ticks">
<span>3.0 MHz</span><span>7.5</span><span>12.0</span><span>17.0</span><span>22.0 MHz</span>
</div>
<div class="fine-controls">
<button class="crt-btn" id="btn-down-coarse">-0.25</button>
<button class="crt-btn" id="btn-down-fine">-0.01</button>
<button class="crt-btn" id="btn-up-fine">+0.01</button>
<button class="crt-btn active" id="btn-squelch">SQL: ON</button>
</div>
</div>
<div class="meter-wrap">
<div class="meter-head">
<span>SIGNAL STRENGTH (S-METER)</span>
<span id="snr-readout">S9 +20 dB</span>
</div>
<div class="s-meter" id="s-meter" aria-hidden="true"></div>
</div>
<div class="scope-frame">
<canvas id="wave-canvas" width="460" height="92"></canvas>
</div>
<div>
<div class="card-head" style="margin-bottom:8px;">
<span>Global Shortwave Presets</span>
<span>5 Beacons</span>
</div>
<div class="preset-grid" id="preset-grid"></div>
</div>
</article>
</section>
</main>
<script>
const STATIONS = [
{
id: 'reykjavik',
city: 'Reykjavik',
call: 'RUV North Atlantic',
prog: 'Arctic Maritime & Glacial Relay',
freq: 6.185,
lat: '64.15° N',
lon: '21.94° W',
az: '342° NNW',
// Polar coords on radar (angle in deg, radius 0..0.82)
angle: 332,
dist: 0.44,
harmonics: [1.0, 2.2, 3.6]
},
{
id: 'tokyo',
city: 'Tokyo',
call: 'NHK World Radio Japan',
prog: 'Pacific Midnight Telemetry',
freq: 11.815,
lat: '35.68° N',
lon: '139.65° E',
az: '044° NE',
angle: 42,
dist: 0.74,
harmonics: [1.4, 2.8, 4.1]
},
{
id: 'buenos-aires',
city: 'Buenos Aires',
call: 'RAE Argentina al Mundo',
prog: 'South Atlantic Tango Broadcast',
freq: 15.345,
lat: '34.60° S',
lon: '58.38° W',
az: '198° SSW',
angle: 204,
dist: 0.68,
harmonics: [0.85, 1.9, 3.1]
},
{
id: 'cairo',
city: 'Cairo',
call: 'ERTU Radio Cairo',
prog: 'Nile Delta Shortwave Service',
freq: 9.720,
lat: '30.04° N',
lon: '31.23° E',
az: '112° ESE',
angle: 118,
dist: 0.56,
harmonics: [1.2, 2.5, 3.9]
},
{
id: 'zurich',
city: 'Zurich',
call: 'SRF Alpine Time Beacon',
prog: 'Atomic Clock & Alpine Weather',
freq: 17.640,
lat: '47.37° N',
lon: '8.54° E',
az: '078° ENE',
angle: 78,
dist: 0.34,
harmonics: [1.6, 3.2, 4.8]
}
];
const state = {
freq: 6.185,
squelch: true,
targetX: 0,
targetY: 0,
reticleX: 190,
reticleY: 190,
sweepAngle: 0,
wavePhase: 0
};
const els = {
freqDisplay: document.getElementById('freq-display'),
freqSlider: document.getElementById('freq-slider'),
lockBadge: document.getElementById('lock-badge'),
stationName: document.getElementById('station-name'),
stationProg: document.getElementById('station-prog'),
coordLat: document.getElementById('coord-lat'),
coordLon: document.getElementById('coord-lon'),
coordAz: document.getElementById('coord-az'),
snrReadout: document.getElementById('snr-readout'),
sMeter: document.getElementById('s-meter'),
presetGrid: document.getElementById('preset-grid'),
btnSquelch: document.getElementById('btn-squelch'),
utcClock: document.getElementById('utc-clock')
};
// Build 12-segment S-Meter
const meterSegs = [];
for (let i = 0; i < 12; i++) {
const seg = document.createElement('div');
seg.className = 's-seg';
els.sMeter.appendChild(seg);
meterSegs.push(seg);
}
// Build Station Preset Cards
els.presetGrid.innerHTML = STATIONS.map(st => `
<button class="preset-card" data-station="${st.id}">
<span>
<span class="preset-city">${st.city}</span>
<span class="preset-call">${st.call}</span>
</span>
<span class="preset-freq">${st.freq.toFixed(3)}</span>
</button>
`).join('');
function getNearestStation(freq) {
let best = STATIONS[0];
let minDiff = Infinity;
STATIONS.forEach(st => {
const d = Math.abs(st.freq - freq);
if (d < minDiff) {
minDiff = d;
best = st;
}
});
// Signal strength 0..1 based on proximity to carrier
const lockStrength = Math.max(0, 1 - minDiff / 0.45);
return { station: best, diff: minDiff, strength: lockStrength };
}
function stationRadarPos(st, cx, cy, maxR) {
const rad = (st.angle - 90) * (Math.PI / 180);
return {
x: cx + Math.cos(rad) * maxR * st.dist,
y: cy + Math.sin(rad) * maxR * st.dist
};
}
function setFrequency(val) {
state.freq = Math.max(3.0, Math.min(22.0, Number(val)));
els.freqSlider.value = state.freq.toFixed(3);
els.freqDisplay.textContent = state.freq.toFixed(3).padStart(6, '0');
const { station, diff, strength } = getNearestStation(state.freq);
const isLocked = diff <= 0.08;
if (isLocked) {
els.lockBadge.textContent = 'CARRIER LOCKED';
els.lockBadge.classList.remove('searching');
els.stationName.textContent = `${station.city} — ${station.call}`;
els.stationProg.textContent = station.prog;
els.coordLat.textContent = station.lat;
els.coordLon.textContent = station.lon;
els.coordAz.textContent = station.az;
} else if (strength > 0.2) {
els.lockBadge.textContent = 'WEAK SIGNAL';
els.lockBadge.classList.add('searching');
els.stationName.textContent = `Drift near ${station.city} (${station.freq.toFixed(3)} MHz)`;
els.stationProg.textContent = 'Fine-tune carrier for clear lock';
} else {
els.lockBadge.textContent = 'ATMOSPHERIC NOISE';
els.lockBadge.classList.add('searching');
els.stationName.textContent = 'Open HF Band — Ionospheric Static';
els.stationProg.textContent = 'Select a preset or sweep dial';
els.coordLat.textContent = '--.--°';
els.coordLon.textContent = '--.--°';
els.coordAz.textContent = 'SCANNING';
}
document.querySelectorAll('.preset-card').forEach(card => {
card.classList.toggle('locked', isLocked && card.dataset.station === station.id);
});
const pos = stationRadarPos(station, 190, 190, 165);
if (strength > 0.25) {
state.targetX = pos.x;
state.targetY = pos.y;
} else {
const driftAngle = (state.freq * 42) * (Math.PI / 180);
state.targetX = 190 + Math.cos(driftAngle) * 70;
state.targetY = 190 + Math.sin(driftAngle) * 70;
}
}
// Event Wiring
els.presetGrid.addEventListener('click', (e) => {
const btn = e.target.closest('.preset-card');
if (!btn) return;
const st = STATIONS.find(s => s.id === btn.dataset.station);
if (st) setFrequency(st.freq);
});
els.freqSlider.addEventListener('input', () => setFrequency(els.freqSlider.value));
document.getElementById('btn-down-coarse').addEventListener('click', () => setFrequency(state.freq - 0.25));
document.getElementById('btn-down-fine').addEventListener('click', () => setFrequency(state.freq - 0.01));
document.getElementById('btn-up-fine').addEventListener('click', () => setFrequency(state.freq + 0.01));
els.btnSquelch.addEventListener('click', () => {
state.squelch = !state.squelch;
els.btnSquelch.classList.toggle('active', state.squelch);
els.btnSquelch.textContent = state.squelch ? 'SQL: ON' : 'SQL: OFF';
});
// Radar Canvas
const radarCanvas = document.getElementById('radar-canvas');
const rCtx = radarCanvas.getContext('2d');
radarCanvas.addEventListener('click', (e) => {
const rect = radarCanvas.getBoundingClientRect();
const x = ((e.clientX - rect.left) / rect.width) * radarCanvas.width;
const y = ((e.clientY - rect.top) / rect.height) * radarCanvas.height;
let chosen = null;
let bestDist = 36;
STATIONS.forEach(st => {
const p = stationRadarPos(st, 190, 190, 165);
const d = Math.hypot(p.x - x, p.y - y);
if (d < bestDist) {
bestDist = d;
chosen = st;
}
});
if (chosen) setFrequency(chosen.freq);
});
function drawRadar() {
const w = radarCanvas.width;
const h = radarCanvas.height;
const cx = w / 2;
const cy = h / 2;
const maxR = 165;
rCtx.clearRect(0, 0, w, h);
// Concentric azimuth rings
rCtx.strokeStyle = 'rgba(70, 255, 150, 0.22)';
rCtx.lineWidth = 1;
[0.25, 0.5, 0.75, 1].forEach(frac => {
rCtx.beginPath();
rCtx.arc(cx, cy, maxR * frac, 0, Math.PI * 2);
rCtx.stroke();
});
// Globe meridian arcs
rCtx.strokeStyle = 'rgba(70, 255, 150, 0.14)';
rCtx.beginPath();
rCtx.ellipse(cx, cy, maxR * 0.52, maxR, 0, 0, Math.PI * 2);
rCtx.stroke();
rCtx.beginPath();
rCtx.ellipse(cx, cy, maxR, maxR * 0.45, 0, 0, Math.PI * 2);
rCtx.stroke();
// Crosshairs
rCtx.strokeStyle = 'rgba(70, 255, 150, 0.22)';
rCtx.beginPath();
rCtx.moveTo(cx - maxR, cy); rCtx.lineTo(cx + maxR, cy);
rCtx.moveTo(cx, cy - maxR); rCtx.lineTo(cx, cy + maxR);
rCtx.stroke();
// Compass labels
rCtx.fillStyle = '#74b28f';
rCtx.font = 'bold 11px JetBrains Mono, monospace';
rCtx.textAlign = 'center';
rCtx.fillText('N', cx, cy - maxR - 6);
rCtx.fillText('S', cx, cy + maxR + 14);
rCtx.fillText('W', cx - maxR - 12, cy + 4);
rCtx.fillText('E', cx + maxR + 12, cy + 4);
// Sweeping phosphor beam
state.sweepAngle = (state.sweepAngle + 0.018) % (Math.PI * 2);
const grad = rCtx.createConicGradient(state.sweepAngle - 0.55, cx, cy);
grad.addColorStop(0, 'rgba(70, 255, 150, 0)');
grad.addColorStop(0.08, 'rgba(70, 255, 150, 0.24)');
grad.addColorStop(0.09, 'rgba(70, 255, 150, 0)');
rCtx.fillStyle = grad;
rCtx.beginPath();
rCtx.arc(cx, cy, maxR, 0, Math.PI * 2);
rCtx.fill();
// Station blips
const { station: activeSt, diff } = getNearestStation(state.freq);
STATIONS.forEach(st => {
const p = stationRadarPos(st, cx, cy, maxR);
const locked = diff <= 0.08 && st.id === activeSt.id;
rCtx.beginPath();
rCtx.arc(p.x, p.y, locked ? 6 : 4, 0, Math.PI * 2);
rCtx.fillStyle = locked ? '#ffba49' : '#46ff96';
rCtx.shadowColor = locked ? '#ffba49' : '#46ff96';
rCtx.shadowBlur = locked ? 12 : 6;
rCtx.fill();
rCtx.shadowBlur = 0;
rCtx.fillStyle = locked ? '#ffba49' : '#9ee8be';
rCtx.font = '10px JetBrains Mono, monospace';
rCtx.textAlign = 'left';
rCtx.fillText(st.city.toUpperCase(), p.x + 9, p.y + 3);
});
// Smoothly animate target lock reticle
state.reticleX += (state.targetX - state.reticleX) * 0.1;
state.reticleY += (state.targetY - state.reticleY) * 0.1;
rCtx.strokeStyle = '#ffba49';
rCtx.lineWidth = 1.5;
rCtx.beginPath();
rCtx.arc(state.reticleX, state.reticleY, 15, 0, Math.PI * 2);
rCtx.stroke();
rCtx.beginPath();
rCtx.moveTo(state.reticleX - 21, state.reticleY); rCtx.lineTo(state.reticleX - 10, state.reticleY);
rCtx.moveTo(state.reticleX + 10, state.reticleY); rCtx.lineTo(state.reticleX + 21, state.reticleY);
rCtx.moveTo(state.reticleX, state.reticleY - 21); rCtx.lineTo(state.reticleX, state.reticleY - 10);
rCtx.moveTo(state.reticleX, state.reticleY + 10); rCtx.lineTo(state.reticleX, state.reticleY + 21);
rCtx.stroke();
}
// Phosphor Waveform & S-Meter Animation
const waveCanvas = document.getElementById('wave-canvas');
const wCtx = waveCanvas.getContext('2d');
function drawWaveform() {
const w = waveCanvas.width;
const h = waveCanvas.height;
wCtx.fillStyle = '#030805';
wCtx.fillRect(0, 0, w, h);
// Centerline & grid
wCtx.strokeStyle = 'rgba(70, 255, 150, 0.16)';
wCtx.lineWidth = 1;
wCtx.beginPath();
wCtx.moveTo(0, h / 2); wCtx.lineTo(w, h / 2);
for (let x = 46; x < w; x += 46) {
wCtx.moveTo(x, 0); wCtx.lineTo(x, h);
}
wCtx.stroke();
const { station, strength } = getNearestStation(state.freq);
state.wavePhase += 0.12;
// Update S-Meter dynamically with subtle ionospheric fading
const fade = Math.sin(state.wavePhase * 0.35) * 0.08;
const effectiveStrength = Math.max(0.05, Math.min(1, strength + fade));
const litCount = Math.round(effectiveStrength * 12);
meterSegs.forEach((seg, idx) => {
const on = idx < litCount;
seg.className = 's-seg' + (on ? (idx >= 10 ? ' on hot' : idx >= 7 ? ' on amber' : ' on') : '');
});
const dbText = strength > 0.8 ? `S9 +${Math.round(effectiveStrength * 30)} dB` : `S${Math.max(1, Math.round(effectiveStrength * 9))} (${Math.round(effectiveStrength * 100)}%)`;
els.snrReadout.textContent = dbText;
// Draw live phosphor trace
wCtx.strokeStyle = strength > 0.7 ? '#46ff96' : '#ffba49';
wCtx.shadowColor = wCtx.strokeStyle;
wCtx.shadowBlur = 8;
wCtx.lineWidth = 2;
wCtx.beginPath();
const noiseAmp = state.squelch && strength < 0.25 ? 2.5 : (1 - strength) * 24;
const sigAmp = strength * 28;
const [h1, h2, h3] = station.harmonics;
for (let x = 0; x < w; x += 3) {
const t = (x / w) * Math.PI * 8;
const carrier =
Math.sin(t * h1 + state.wavePhase) * sigAmp * 0.6 +
Math.sin(t * h2 - state.wavePhase * 1.4) * sigAmp * 0.28 +
Math.cos(t * h3 + state.wavePhase * 0.7) * sigAmp * 0.16;
const staticNoise = (Math.random() - 0.5) * noiseAmp;
const y = h / 2 + carrier + staticNoise;
if (x === 0) wCtx.moveTo(x, y);
else wCtx.lineTo(x, y);
}
wCtx.stroke();
wCtx.shadowBlur = 0;
}
function updateUTC() {
const now = new Date();
const iso = now.toISOString().slice(11, 19);
els.utcClock.textContent = `UTC ${iso} Z`;
}
function frame() {
drawRadar();
drawWaveform();
requestAnimationFrame(frame);
}
setFrequency(6.185);
updateUTC();
setInterval(updateUTC, 1000);
requestAnimationFrame(frame);
</script>
</body>
</html>