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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
| import { useEffect } from "react"
| import { motion, stagger, useAnimate } from "framer-motion"
|
| export const WordEffect = ({
| words,
| filter = true,
| duration = 0.5,
| delay = 0.1,
| color = "black",
| }) => {
| const [scope, animate] = useAnimate()
| const wordsArray = words.split(" ")
| useEffect(() => {
| animate(
| "span",
| {
| opacity: 1,
| filter: filter ? "blur(0px)" : "none",
| },
| {
| duration: duration ?? 1,
| delay: stagger(delay ?? 0.1),
| },
| )
| }, [scope.current])
|
| const renderWords = () => {
| return (
| <motion.div ref={scope}>
| {wordsArray.map((word, idx) => {
| return (
| <motion.span
| key={word + idx}
| style={{
| opacity: 0,
| filter: filter ? "blur(10px)" : "none",
| color: color,
| fontWeight: 'bold',
| display: 'inline-block',
| }}
| >
| {word}
| </motion.span>
| )
| })}
| </motion.div>
| )
| }
|
| return (
| <div
| style={{
| fontWeight: 'bold',
| }}
| >
| <div style={{ marginTop: '1rem' }}>
| <div
| style={{
| color: 'black',
| fontSize: '1.5rem',
| lineHeight: '2rem',
| letterSpacing: '0.05em',
| }}
| >
| {renderWords()}
| </div>
| </div>
| </div >
| )
| }
|
|