Web frontend

This commit is contained in:
2026-08-27 12:32:20 +02:00
parent d44c24ec97
commit edb6e5e027
97 changed files with 9535 additions and 195 deletions

22
web/src/lib/pop.ts Normal file
View File

@@ -0,0 +1,22 @@
/** The mockup's click feedback: a short rising blip per interaction. */
let context: AudioContext | null = null;
export function playPop(frequency: number): void {
try {
context ??= new AudioContext();
const now = context.currentTime;
const oscillator = context.createOscillator();
const gain = context.createGain();
oscillator.type = "sine";
oscillator.frequency.setValueAtTime(frequency, now);
oscillator.frequency.exponentialRampToValueAtTime(frequency * 1.8, now + 0.08);
gain.gain.setValueAtTime(0.15, now);
gain.gain.exponentialRampToValueAtTime(0.001, now + 0.15);
oscillator.connect(gain).connect(context.destination);
oscillator.start();
oscillator.stop(now + 0.16);
} catch {
// No audio context before the first user gesture, and on some browsers never.
}
}