UI consolidation

This commit is contained in:
Michael Freno
2026-01-06 10:16:38 -05:00
parent c468b442c8
commit 609932a55b
13 changed files with 383 additions and 517 deletions

View File

@@ -72,3 +72,32 @@ export function insertSoftHyphens(
})
.join(" ");
}
export function glitchText(
originalText: string,
setter: (text: string) => void,
glitchInterval: number = 300,
glitchLength: number = 80
) {
const glitchChars = "!@#$%^&*()_+-=[]{}|;':\",./<>?~`";
const interval = setInterval(() => {
if (Math.random() > 0.9) {
let glitched = "";
for (let i = 0; i < originalText.length; i++) {
if (Math.random() > 0.8) {
glitched +=
glitchChars[Math.floor(Math.random() * glitchChars.length)];
} else {
glitched += originalText[i];
}
}
setter(glitched);
setTimeout(() => {
setter(originalText);
}, glitchLength);
}
}, glitchInterval);
return interval;
}