added sound
This commit is contained in:
26
index.html
26
index.html
@@ -55,6 +55,23 @@
|
|||||||
function sleep(ms){ return new Promise(r => setTimeout(r, ms)); }
|
function sleep(ms){ return new Promise(r => setTimeout(r, ms)); }
|
||||||
function bodyGlitch(){ document.body.classList.add('glitch'); setTimeout(()=> document.body.classList.remove('glitch'), 180); }
|
function bodyGlitch(){ document.body.classList.add('glitch'); setTimeout(()=> document.body.classList.remove('glitch'), 180); }
|
||||||
|
|
||||||
|
// --- Typing click sound (minimal) ---
|
||||||
|
const AudioCtx = window.AudioContext || window.webkitAudioContext;
|
||||||
|
let ctx = null;
|
||||||
|
function ensureAudio(){ if (!ctx) ctx = new AudioCtx(); if (ctx.state === 'suspended') ctx.resume(); }
|
||||||
|
function typeClick(){
|
||||||
|
if (!ctx) return; // only after first click enables audio
|
||||||
|
const osc = ctx.createOscillator();
|
||||||
|
const gain = ctx.createGain();
|
||||||
|
osc.type = 'square';
|
||||||
|
osc.frequency.value = 800 + Math.random()*200;
|
||||||
|
gain.gain.setValueAtTime(0.05, ctx.currentTime);
|
||||||
|
gain.gain.exponentialRampToValueAtTime(0.0001, ctx.currentTime + 0.04);
|
||||||
|
osc.connect(gain).connect(ctx.destination);
|
||||||
|
osc.start();
|
||||||
|
osc.stop(ctx.currentTime + 0.05);
|
||||||
|
}
|
||||||
|
|
||||||
const bootLines = [
|
const bootLines = [
|
||||||
'Phoenix BIOS v4.0 Release 6.0',
|
'Phoenix BIOS v4.0 Release 6.0',
|
||||||
'Copyright (C) 1985-2025 Phoenix Technologies Ltd.',
|
'Copyright (C) 1985-2025 Phoenix Technologies Ltd.',
|
||||||
@@ -93,6 +110,7 @@
|
|||||||
for (let i=0; i<line.length; i++){
|
for (let i=0; i<line.length; i++){
|
||||||
if (aborted) return;
|
if (aborted) return;
|
||||||
screen.append(document.createTextNode(line[i]));
|
screen.append(document.createTextNode(line[i]));
|
||||||
|
typeClick();
|
||||||
screen.scrollTop = screen.scrollHeight;
|
screen.scrollTop = screen.scrollHeight;
|
||||||
await sleep(speed>1 ? 3 : 12 + Math.random()*30);
|
await sleep(speed>1 ? 3 : 12 + Math.random()*30);
|
||||||
}
|
}
|
||||||
@@ -100,7 +118,8 @@
|
|||||||
if (line.startsWith('[WARN]')) bodyGlitch();
|
if (line.startsWith('[WARN]')) bodyGlitch();
|
||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener('click', () => { speed = 3; });
|
// Click once to enable audio & optionally speed up
|
||||||
|
document.addEventListener('click', () => { ensureAudio(); speed = 3; }, { once: false });
|
||||||
|
|
||||||
(async function run(){
|
(async function run(){
|
||||||
await sleep(200);
|
await sleep(200);
|
||||||
@@ -112,11 +131,12 @@
|
|||||||
}
|
}
|
||||||
await sleep(300);
|
await sleep(300);
|
||||||
|
|
||||||
const final = 'Incoming message... Andy is a cock.';
|
const final = 'Incoming message... Andy is a cock!';
|
||||||
const span = document.createElement('span');
|
const span = document.createElement('span');
|
||||||
screen.append(span);
|
screen.append(span);
|
||||||
for (let i=0; i<final.length; i++){
|
for (let i=0; i<final.length; i++){
|
||||||
span.textContent += final[i];
|
span.textContent += final[i];
|
||||||
|
typeClick();
|
||||||
screen.scrollTop = screen.scrollHeight;
|
screen.scrollTop = screen.scrollHeight;
|
||||||
await sleep(110 / speed);
|
await sleep(110 / speed);
|
||||||
}
|
}
|
||||||
@@ -129,4 +149,4 @@
|
|||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user