Add typewriter clatter during text reveal
A dry synthesized key-clack (filtered noise burst with pitch jitter) plays as each line types out — every other non-space character — for a detective-terminal feel. Skipped in the editor preview and when reduced-motion is set. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -84,6 +84,13 @@ export function DialoguePlayer({ node, onExit, inline, startId }: { node: { utte
|
||||
return () => window.clearInterval(id)
|
||||
}, [currentId, fullText, reduced]) // eslint-disable-line react-hooks/exhaustive-deps
|
||||
|
||||
// Typewriter clatter as characters are revealed (every other non-space char).
|
||||
useEffect(() => {
|
||||
if (inline || charCount === 0 || charCount > fullText.length) return
|
||||
const ch = fullText[charCount - 1]
|
||||
if (ch && ch !== ' ' && charCount % 2 === 0) audio.type()
|
||||
}, [charCount]) // eslint-disable-line react-hooks/exhaustive-deps
|
||||
|
||||
const pick = (choice: RuntimeUtterance) => {
|
||||
if (!inline) audio.sfx('choice')
|
||||
if (choice.childIds.length > 0) setCurrentId(choice.childIds[0])
|
||||
|
||||
Reference in New Issue
Block a user