feat: terminal text

This commit is contained in:
Barrett Ruth 2024-06-07 22:27:27 -05:00
parent ac76a4eb16
commit 4339ebe265
4 changed files with 32 additions and 147 deletions

21
scripts/index.js Normal file
View file

@ -0,0 +1,21 @@
function typechars(e, url = "wip.html") {
e.preventDefault();
const text = ` ${e.target.textContent.toLowerCase()}/`;
const terminalPrompt = document.querySelector(".prompt");
let i = 0;
function typechar() {
if (i < text.length) {
terminalPrompt.innerHTML += text.charAt(i);
i++;
setTimeout(typechar, 1000 / text.length);
} else {
setTimeout(() => {
window.location.href = url;
}, 500);
}
}
typechar();
}