Classic terminal-style text animations
// Typewriter Effect Implementation
class TypeWriter {
constructor(element, text, speed = 50) {
this.element = element;
this.text = text;
this.speed = speed;
this.index = 0;
this.isTyping = false;
}
type() {
if (this.index < this.text.length) {
this.element.textContent += this.text.charAt(this.index);
this.index++;
setTimeout(() => this.type(), this.speed);
}
}
delete() {
if (this.element.textContent.length > 0) {
this.element.textContent =
this.element.textContent.slice(0, -1);
setTimeout(() => this.delete(), this.speed / 2);
}
}
reset() {
this.element.textContent = '';
this.index = 0;
}
}