File size: 370 Bytes
cc1ccff
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
// Simulate typing effect by revealing text one character at a time
export function simulateTyping(fullText, onUpdate, onComplete, delay = 20) {
  let index = 0;
  const interval = setInterval(() => {
    onUpdate((prev) => prev + fullText[index]);
    index++;
    if (index >= fullText.length) {
      clearInterval(interval);
      onComplete();
    }
  }, delay);
}