-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDynamicWord.jsx
More file actions
29 lines (24 loc) · 766 Bytes
/
DynamicWord.jsx
File metadata and controls
29 lines (24 loc) · 766 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { useState, useEffect } from 'react';
import DecryptedText from './DecryptedText';
const words = ['ChatGPT', 'Google Ai Overviews', 'Microsoft Copilot', 'Perplexity'];
export default function DynamicWord() {
const [currentWordIndex, setCurrentWordIndex] = useState(0);
useEffect(() => {
const interval = setInterval(() => {
setCurrentWordIndex((prev) => (prev + 1) % words.length);
}, 3000);
return () => clearInterval(interval);
}, []);
return (
<DecryptedText
text={words[currentWordIndex]}
animateOn="view"
sequential={true}
revealDirection="start"
speed={50}
maxIterations={10}
className="text_changer_text"
encryptedClassName="text_changer_text--encrypted"
/>
);
}