// credits.js — the credits page: a demo-scene intro (starfield, copper // bars, the wobbling logo, a glenz vector, the credits zooming in and a // sine scroller, with a chiptune), then the credits as a page. // All drawn in the browser; nothing on the hotspot. The canvas is for show // (hidden from screen readers): the page below says it all. No motion for // anyone whose system asks for reduced motion. The music is on from the // start (from the first click or key press, where the browser holds sound // back until then); the Music button turns it off. 'use strict'; (function() { function t(key, fallback) { return (typeof i18n === 'function') ? i18n(key, fallback) : fallback; } // ── Who we thank ── var GH = 'https://github.com/'; var PEOPLE = [ { group: 'engine', call: 'G4KLX', name: 'Jonathan Naylor', url: GH + 'g4klx', key: 'credits.g4klx', en: 'MMDVM, MMDVM-Host, DMRGateway and the gateways for every mode: the heart of every hotspot' }, { group: 'engine', call: 'CA6JAU', name: 'Andy', url: GH + 'juribeparada', key: 'credits.ca6jau', en: 'The MMDVM_HS firmware for hotspot boards, and the cross-mode tools' }, { group: 'engine', call: 'F4FXL', name: 'Geoffrey Merck', url: GH + 'F4FXL', key: 'credits.f4fxl', en: 'DStarGateway, the modern D-Star gateway' }, { group: 'engine', call: '', name: 'Doug McLain', url: GH + 'nostar', key: 'credits.nostar', en: 'Keeping the cross-mode tools going' }, { group: 'engine', call: '', name: 'Charles-Henri Hallard', url: GH + 'hallard', key: 'credits.hallard', en: 'ArduiPi_OLED, the OLED display library' }, { group: 'engine', call: '', name: 'Gordon Henderson & the WiringPi community', url: GH + 'WiringPi/WiringPi', key: 'credits.wiringpi', en: "WiringPi, the Raspberry Pi's GPIO library" }, { group: 'hardware', call: 'KI6ZUM', name: 'Jim McLaughlin', url: '', key: 'credits.ki6zum', en: 'The ZUMspot hotspot boards, with VE2GZI on the RPi and Libre Kit boards' }, // Board designers as the MMDVM_HS firmware credits them: callsigns // and boards (product names, so not translated) { group: 'hardware', call: 'DB9MAT · DF2ET · DO7EN', name: 'MMDVM_HS_Hat & MMDVM_HS_Dual_Hat' }, { group: 'hardware', call: 'BI7JTA', name: 'Nano hotSPOT' }, { group: 'hardware', call: 'VR2VYE', name: 'Nano hotSPOT duplex' }, { group: 'hardware', call: 'BG4TGO · BG5HHP', name: 'NanoDV' }, { group: 'hardware', call: 'BG3MDO', name: 'D2RG MMDVM_HS' }, { group: 'hardware', call: 'EA7GIB', name: 'MMDVM_HS GPIO & duplex boards' }, { group: 'community', call: 'M1DNS', name: 'Andrew', url: 'https://forum.pistar.uk/', key: 'credits.m1dns', en: 'Has looked after the Pi-Star Facebook group and the Support Forum for many years: one of the unsung heroes' }, { group: 'community', call: 'KC1AWV', name: 'Steve Miller', url: 'https://dvref.com/', key: 'credits.kc1awv', en: 'Founded DVRef, the registry of reflectors that the host files for every hotspot and repeater are built from' }, { group: 'friends', call: 'SharkRF', name: 'Ákos Marton (HG1MA) & Norbert Varga (HA2NON)', url: 'https://www.sharkrf.com/', key: 'credits.sharkrf', en: 'openSPOT: a different way on to the air. Competition is what drives innovation' }, { group: 'friends', call: 'W0CHP', name: 'Chip', url: 'https://w0chp.radio/', key: 'credits.w0chp', en: 'WPSD, a fellow hotspot suite, and friendly competition; co-developer of DVRef' } ]; var LIBRARIES = [ ['chi', GH + 'go-chi/chi'], ['go-ini', GH + 'go-ini/ini'], ['Eclipse Paho', GH + 'eclipse/paho.golang'], ['coder/websocket', GH + 'coder/websocket'], ['miekg/dns', GH + 'miekg/dns'], ['timezonemapper', GH + 'zsefvlol/timezonemapper'], ['Gorilla WebSocket', GH + 'gorilla/websocket'], ['DSEG fonts', 'https://www.keshikan.net/fonts-e.html'], ['Matrix Sans', 'https://friedorange.github.io/MatrixSans/'], ['Oxanium', 'https://github.com/sevmeyer/oxanium'], ['JetBrains Mono', 'https://www.jetbrains.com/lp/mono/'], ['Alpine Linux', 'https://alpinelinux.org/'], ['Raspberry Pi OS', 'https://www.raspberrypi.com/software/'] ]; var NETWORKS = [ ['DVRef', 'https://dvref.com/'], ['BrandMeister', 'https://brandmeister.network/'], ['TGIF', 'https://tgif.network/'], ['DAPNET', 'https://hampager.de/'], ['ircDDB', 'https://www.ircddb.net/'], ['RadioID.net', 'https://radioid.net/'] ]; var CLOSING = { others: 'The countless other developers and contributors whose code, fixes, testing and ideas run through every part of Pi-Star.', missed: 'And if you feel we have missed you out: there are so many of you, and we are grateful to every one. Thank you.', beta: 'Thank you to everyone taking part in the beta. Every bug report, every log you sent and every piece of feedback has made Pi-Star better. You found what we could not.', users: 'A special thank you to everyone who runs Pi-Star. You test it, report the bugs, answer each other\'s questions and keep Pi-Star going. This is for you.' }; var GROUPS = [ ['engine', 'credits.groupEngine', 'The engine room'], ['hardware', 'credits.groupHardware', 'Hardware'], ['community', 'credits.groupCommunity', 'Community'], ['friends', 'credits.groupFriends', 'Fellow hotspot makers'] ]; // ── The page ── function el(tag, cls, text) { var e = document.createElement(tag); if (cls) e.className = cls; if (text != null) e.textContent = text; return e; } function link(text, url) { if (!url) return document.createTextNode(text); var a = el('a', '', text); a.href = url; a.target = '_blank'; a.rel = 'noopener noreferrer'; return a; } function buildPage() { var root = document.getElementById('credit-groups'); GROUPS.forEach(function(g) { var sec = el('section', 'group'); sec.appendChild(el('h2', '', t(g[1], g[2]))); var ul = el('ul', 'cards'); PEOPLE.filter(function(p) { return p.group === g[0]; }).forEach(function(p) { var li = el('li', 'card'); if (p.call) li.appendChild(el('div', 'call', p.call)); var name = el('div', 'name'); name.appendChild(link(p.name, p.url)); li.appendChild(name); if (p.key) li.appendChild(el('p', 'role', t(p.key, p.en))); ul.appendChild(li); }); sec.appendChild(ul); root.appendChild(sec); }); [['credits.groupLibraries', 'Libraries, fonts and systems', LIBRARIES], ['credits.groupNetworks', 'Networks and data', NETWORKS]].forEach(function(g) { var sec = el('section', 'group'); sec.appendChild(el('h2', '', t(g[0], g[1]))); var p = el('p', 'small-list'); g[2].forEach(function(item, i) { if (i) p.appendChild(document.createTextNode(' · ')); p.appendChild(link(item[0], item[1])); }); sec.appendChild(p); root.appendChild(sec); }); // Everyone else who wrote, fixed or tested a part of it var more = el('section', 'group'); more.appendChild(el('h2', '', t('credits.othersTitle', 'And so many more'))); more.appendChild(el('p', 'intro', t('credits.others', CLOSING.others))); more.appendChild(el('p', 'intro', t('credits.missed', CLOSING.missed))); root.appendChild(more); // The beta testers: their reports and feedback var beta = el('section', 'group'); beta.appendChild(el('h2', '', t('credits.betaTitle', 'The beta testers'))); beta.appendChild(el('p', 'intro', t('credits.beta', CLOSING.beta))); root.appendChild(beta); // And the people who run it var you = el('section', 'group thanks'); you.appendChild(el('h2', '', t('credits.usersTitle', 'The Pi-Star community'))); you.appendChild(el('p', 'intro', t('credits.users', CLOSING.users))); you.appendChild(el('p', 'forever', t('credits.forever', 'Pi-Star Forever!'))); you.appendChild(el('p', 'slogan', t('credits.slogan', 'Keep it on the air!'))); root.appendChild(you); } // ── The demo ── var reduce = window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches; function demo() { var canvas = document.getElementById('demo'); if (!canvas || reduce) return; var ctx = canvas.getContext('2d'); var w = 0, h = 0, ratio = Math.min(window.devicePixelRatio || 1, 2); var logo = new Image(), logoReady = false; logo.onload = function() { logoReady = true; }; logo.src = '/static/img/logo-login.png'; function size() { var r = canvas.getBoundingClientRect(); w = r.width; h = r.height; canvas.width = Math.round(w * ratio); canvas.height = Math.round(h * ratio); ctx.setTransform(ratio, 0, 0, ratio, 0, 0); } size(); window.addEventListener('resize', size); // Starfield: 3D points flying at us var stars = []; for (var i = 0; i < 260; i++) stars.push({ x: (Math.random() - 0.5) * 2, y: (Math.random() - 0.5) * 2, z: Math.random() }); function drawStars(dt) { for (var i = 0; i < stars.length; i++) { var s = stars[i]; s.z -= dt * 0.18; if (s.z <= 0.02) { s.x = (Math.random() - 0.5) * 2; s.y = (Math.random() - 0.5) * 2; s.z = 1; } var sx = w / 2 + s.x / s.z * w * 0.25, sy = h / 2 + s.y / s.z * h * 0.25; if (sx < 0 || sx > w || sy < 0 || sy > h) continue; var b = 1 - s.z, sz = b * 2.6 + 0.4; ctx.fillStyle = 'rgba(255,255,255,' + (0.25 + b * 0.75) + ')'; ctx.fillRect(sx, sy, sz, sz); } } // Copper bars: rainbow raster bars swinging on sine waves function drawCopper(time) { var bars = 7, bh = Math.max(10, h * 0.03); for (var i = 0; i < bars; i++) { var y = h * 0.5 + Math.sin(time * 1.3 + i * 0.55) * h * 0.36; var hue = (time * 40 + i * 50) % 360; var g = ctx.createLinearGradient(0, y - bh, 0, y + bh); g.addColorStop(0, 'hsla(' + hue + ',100%,20%,0)'); g.addColorStop(0.35, 'hsla(' + hue + ',100%,45%,0.55)'); g.addColorStop(0.5, 'hsla(' + hue + ',100%,85%,0.75)'); g.addColorStop(0.65, 'hsla(' + hue + ',100%,45%,0.55)'); g.addColorStop(1, 'hsla(' + hue + ',100%,20%,0)'); ctx.fillStyle = g; ctx.fillRect(0, y - bh, w, bh * 2); } } // The logo, wobbling a line at a time function drawLogo(time) { if (!logoReady) return; var lw = Math.min(w * 0.82, 760), lh = lw * logo.height / logo.width; var x0 = (w - lw) / 2, y0 = h * 0.07; var rows = Math.ceil(lh / 2); for (var r = 0; r < rows; r++) { var sy = r / rows * logo.height, sh = logo.height / rows; var off = Math.sin(time * 3 + r * 0.12) * lw * 0.025; ctx.drawImage(logo, 0, sy, logo.width, sh, x0 + off, y0 + r * 2, lw, 2.2); } } // A glenz vector: a translucent spinning octahedron var V = [[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]]; var F = [[0,2,4],[2,1,4],[1,3,4],[3,0,4],[2,0,5],[1,2,5],[3,1,5],[0,3,5]]; function drawGlenz(time) { var ax = time * 0.7, ay = time * 0.9, az = time * 0.4; var cx = Math.cos(ax), sx = Math.sin(ax), cy = Math.cos(ay), sy = Math.sin(ay), cz = Math.cos(az), sz = Math.sin(az); var size = Math.min(w, h) * 0.26, ox = w / 2, oy = h * 0.52; var P = V.map(function(v) { var x = v[0], y = v[1], z = v[2], t1; t1 = y * cx - z * sx; z = y * sx + z * cx; y = t1; t1 = x * cy + z * sy; z = -x * sy + z * cy; x = t1; t1 = x * cz - y * sz; y = x * sz + y * cz; x = t1; var p = 3 / (3 + z); return { x: ox + x * size * p, y: oy + y * size * p, z: z }; }); var faces = F.map(function(f, i) { var a = P[f[0]], b = P[f[1]], c = P[f[2]]; var cross = (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x); return { f: f, z: (a.z + b.z + c.z) / 3, front: cross < 0, i: i }; }).sort(function(a, b) { return b.z - a.z; }); faces.forEach(function(fc) { var a = P[fc.f[0]], b = P[fc.f[1]], c = P[fc.f[2]]; ctx.beginPath(); ctx.moveTo(a.x, a.y); ctx.lineTo(b.x, b.y); ctx.lineTo(c.x, c.y); ctx.closePath(); var hue = fc.i % 2 ? 195 : 315; ctx.fillStyle = 'hsla(' + hue + ',100%,' + (fc.front ? 60 : 35) + '%,' + (fc.front ? 0.22 : 0.12) + ')'; ctx.fill(); ctx.strokeStyle = 'hsla(' + hue + ',100%,80%,' + (fc.front ? 0.35 : 0.12) + ')'; ctx.lineWidth = 1; ctx.stroke(); }); } // The credits, one at a time, zooming in and out var slides = PEOPLE.filter(function(p) { return p.key; }).map(function(p) { return { top: p.call || '', name: p.name, role: t(p.key, p.en) }; }); // The board designers share a slide, after the ZUMspot one var boards = PEOPLE.filter(function(p) { return !p.key; }); slides.splice(slides.findIndex(function(s) { return s.top === 'KI6ZUM'; }) + 1, 0, { top: t('credits.groupHardware', 'Hardware'), name: '', role: boards.map(function(p) { return p.call + ': ' + p.name; }).join(' · ') }); // The finale: everyone else, the community, and the sign-off slides.push({ top: t('credits.othersTitle', 'And so many more'), name: '', role: t('credits.others', CLOSING.others) }); slides.push({ top: t('credits.thanks', 'Thank you'), name: '', role: t('credits.missed', CLOSING.missed) }); slides.push({ top: t('credits.betaTitle', 'The beta testers'), name: '', role: t('credits.beta', CLOSING.beta) }); slides.push({ top: t('credits.usersTitle', 'The Pi-Star community'), name: '', role: t('credits.users', CLOSING.users) }); slides.push({ top: t('credits.forever', 'Pi-Star Forever!'), name: '', role: t('credits.slogan', 'Keep it on the air!'), finale: true }); slides.unshift({ top: t('credits.title', 'Credits'), name: '', role: t('credits.intro', 'Pi-Star stands on the shoulders of these people and their work. Thank you, every one of you.') }); function chrome(y, size) { var g = ctx.createLinearGradient(0, y - size, 0, y + size * 0.2); g.addColorStop(0, '#ffffff'); g.addColorStop(0.45, '#9fdcff'); g.addColorStop(0.5, '#3a5dff'); g.addColorStop(1, '#ff9df0'); return g; } function wrap(text, maxW) { var words = text.split(' '), lines = [], line = ''; words.forEach(function(wd) { var test = line ? line + ' ' + wd : wd; if (ctx.measureText(test).width > maxW && line) { lines.push(line); line = wd; } else line = test; }); if (line) lines.push(line); return lines; } var SLIDE = 5.5; function drawSlide(time) { var n = Math.floor(time / SLIDE) % slides.length, p = (time % SLIDE) / SLIDE; var s = slides[n]; var zoom = p < 0.12 ? p / 0.12 : p > 0.88 ? (1 - p) / 0.12 : 1; var scale = 0.6 + 0.4 * Math.min(1, zoom), alpha = Math.min(1, zoom * 1.4); var cy = h * 0.52, big = Math.min(w * 0.11, h * 0.12, 96); ctx.save(); ctx.globalAlpha = alpha; ctx.translate(w / 2, cy); ctx.scale(scale, scale); ctx.translate(-w / 2, -cy); ctx.textAlign = 'center'; ctx.shadowColor = 'rgba(0,0,0,0.9)'; ctx.shadowBlur = 12; ctx.font = '800 ' + big + 'px "JetBrains Mono", monospace'; var tw = ctx.measureText(s.top).width, tb = big; if (tw > w * 0.92) { tb = Math.floor(big * w * 0.92 / tw); ctx.font = '800 ' + tb + 'px "JetBrains Mono", monospace'; } if (s.finale) { var g = ctx.createLinearGradient(w * 0.1, 0, w * 0.9, 0); for (var k = 0; k <= 6; k++) g.addColorStop(k / 6, 'hsl(' + ((time * 90 + k * 60) % 360) + ',100%,65%)'); ctx.fillStyle = g; ctx.shadowColor = 'hsl(' + ((time * 90) % 360) + ',100%,50%)'; ctx.shadowBlur = 24; } else { ctx.fillStyle = chrome(cy - big * 0.3, tb); } ctx.fillText(s.top, w / 2, cy - big * 0.3); ctx.shadowColor = 'rgba(0,0,0,0.9)'; ctx.shadowBlur = 12; if (s.name) { ctx.font = '700 ' + Math.max(18, Math.round(big * 0.34)) + 'px "JetBrains Mono", monospace'; ctx.fillStyle = '#ffffff'; ctx.fillText(s.name, w / 2, cy + big * 0.32); } var rs = Math.max(14, Math.round(big * 0.24)), ry = cy + big * 0.32 + (s.name ? Math.max(18, big * 0.34) : 0) + rs * 0.6; ctx.font = rs + 'px "JetBrains Mono", monospace'; ctx.fillStyle = '#ffd6f6'; wrap(s.role, w * 0.86).forEach(function(line, i) { ctx.fillText(line, w / 2, ry + i * rs * 1.35); }); ctx.restore(); } // The sine scroller var names = PEOPLE.map(function(p) { return !p.key ? p.call : p.call ? p.name + ' (' + p.call + ')' : p.name; }); var scrollText = (' *** PI-STAR *** ' + t('credits.scrollStart', 'Pi-Star would not exist without these people. Greetings and thanks to') + ' ' + names.join(' * ') + ' ... ' + t('credits.scrollOthers', 'and the countless other developers and contributors') + ' ... ' + t('credits.scrollEnd', 'and to every amateur who keeps a hotspot on the air. 73 from MW0MWZ!') + ' *** ' + t('credits.forever', 'Pi-Star Forever!') + ' ' + t('credits.slogan', 'Keep it on the air!') + ' ').toUpperCase(); var scrollX = 0; // Sized to the screen so every width sees the same dance: the text // also follows the width (a phone keeps ~20 letters in view), at // least three waves across (a wide screen keeps its ~520px ones, // never under six letters a wave), and a steady letters-a-second pace function drawScroller(time, dt) { var fs = Math.max(18, Math.min(h * 0.075, w / 14, 64)); ctx.font = '800 ' + fs + 'px "JetBrains Mono", monospace'; ctx.textAlign = 'left'; var cw = ctx.measureText('M').width, total = scrollText.length * cw; var k = 2 * Math.PI / Math.max(cw * 6, Math.min(w / 3, 524)); scrollX = (scrollX + dt * Math.max(cw * 8, w * 0.16)) % (total + w); var base = h - fs * 1.1; for (var i = 0; i < scrollText.length; i++) { var x = w - scrollX + i * cw; if (x < -cw || x > w) continue; var y = base + Math.sin(x * k + time * 3) * fs * 0.45; var hue = (x * k * 33 + time * 120) % 360; ctx.fillStyle = 'hsl(' + hue + ',100%,65%)'; ctx.shadowColor = 'hsl(' + hue + ',100%,40%)'; ctx.shadowBlur = 10; ctx.fillText(scrollText.charAt(i), x, y); } ctx.shadowBlur = 0; } var last = 0, start = 0, frame = 0; function draw(now) { if (!start) start = now; var dt = last ? Math.min((now - last) / 1000, 0.05) : 0; last = now; var time = (now - start) / 1000; ctx.fillStyle = '#000000'; ctx.fillRect(0, 0, w, h); drawStars(dt); drawCopper(time); drawGlenz(time); drawLogo(time); drawSlide(time); drawScroller(time, dt); frame = requestAnimationFrame(draw); } document.addEventListener('visibilitychange', function() { if (document.hidden) { cancelAnimationFrame(frame); } else { last = 0; frame = requestAnimationFrame(draw); } }); frame = requestAnimationFrame(draw); } // ── The music: a four-channel chiptune, made as it plays ── var audio = null; function music(on) { if (!on) { if (audio) { clearInterval(audio.timer); audio.ctx.close(); audio = null; } return; } if (audio) return; var AC = window.AudioContext || window.webkitAudioContext; if (!AC) return; var ac = new AC(); var master = ac.createGain(); master.gain.value = 0.22; master.connect(ac.destination); var noise = ac.createBuffer(1, ac.sampleRate * 0.3, ac.sampleRate), nd = noise.getChannelData(0); for (var i = 0; i < nd.length; i++) nd[i] = Math.random() * 2 - 1; var step = 60 / 132 / 4; // sixteenths at 132 BPM // A minor, F, C, G: a bar each var chords = [[57, 60, 64], [53, 57, 60], [48, 52, 55], [55, 59, 62]]; var bass = [45, 41, 36, 43]; function hz(n) { return 440 * Math.pow(2, (n - 69) / 12); } function tone(type, freq, at, len, vol, slide) { var o = ac.createOscillator(), g = ac.createGain(); o.type = type; o.frequency.setValueAtTime(freq, at); if (slide) o.frequency.exponentialRampToValueAtTime(slide, at + len); g.gain.setValueAtTime(vol, at); g.gain.exponentialRampToValueAtTime(0.0008, at + len); o.connect(g); g.connect(master); o.start(at); o.stop(at + len + 0.02); } function hiss(at, len, vol, hp) { var s = ac.createBufferSource(), f = ac.createBiquadFilter(), g = ac.createGain(); s.buffer = noise; f.type = 'highpass'; f.frequency.value = hp; g.gain.setValueAtTime(vol, at); g.gain.exponentialRampToValueAtTime(0.0008, at + len); s.connect(f); f.connect(g); g.connect(master); s.start(at); s.stop(at + len + 0.02); } var n = 0, next = ac.currentTime + 0.1; function schedule() { while (next < ac.currentTime + 0.2) { var bar = Math.floor(n / 16) % 4, s = n % 16, ch = chords[bar]; // Arpeggio, the classic three-note chip chord tone('square', hz(ch[s % 3] + 12), next, step * 0.9, 0.09); // Bass: root on the beat, octave on the off-beat if (s % 2 === 0) tone('triangle', hz(bass[bar] + (s % 4 ? 12 : 0)), next, step * 1.8, 0.35); // Drums: kick on 1 and 3, snare on 2 and 4, hats between if (s % 8 === 0) tone('sine', 120, next, 0.18, 0.9, 40); if (s % 8 === 4) hiss(next, 0.16, 0.45, 1200); if (s % 2 === 1) hiss(next, 0.04, 0.12, 7000); // A little lead tune over the top, every other bar if (Math.floor(n / 16) % 2 === 1 && s % 4 === 0) tone('sawtooth', hz(ch[(s / 4) % 3] + 24), next, step * 3.5, 0.05); next += step; n++; } } audio = { ctx: ac, timer: setInterval(schedule, 50) }; schedule(); } // Browsers hold sound back until the visitor has clicked or pressed // a key on the page: the music is on from the start, and plays from // the first click or key press if the browser held it back. function waiting() { return audio && audio.ctx.state === 'suspended'; } function init() { buildPage(); demo(); var btn = document.getElementById('music'); if (!btn) return; music(true); var unlockedAt = 0; function resume() { if (waiting()) { unlockedAt = Date.now(); audio.ctx.resume(); } if (!waiting()) { ['pointerdown', 'keydown', 'touchend'].forEach(function(ev) { document.removeEventListener(ev, resume, true); }); } } ['pointerdown', 'keydown', 'touchend'].forEach(function(ev) { document.addEventListener(ev, resume, true); }); btn.addEventListener('click', function() { // Held back until now: this click is what lets it play, so // it starts the music rather than turning it off if (Date.now() - unlockedAt < 1500) { unlockedAt = 0; return; } var on = btn.getAttribute('aria-pressed') !== 'true'; btn.setAttribute('aria-pressed', on ? 'true' : 'false'); music(on); }); } if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', init); else init(); })();