-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest
More file actions
35 lines (31 loc) · 960 Bytes
/
Copy pathtest
File metadata and controls
35 lines (31 loc) · 960 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
30
31
32
33
34
35
import { useGSAP } from "@gsap/react";
import { ScrollTrigger } from "gsap/ScrollTrigger";
gsap.registerPlugin(ScrollTrigger);
const roles = ["AI/ML Developer", "UI/UX Designer", "Software Developer", "AR/VR Explorer"];
const HeroSection = () => {
const [roleIndex, setRoleIndex] = useState(0);
const [text, setText] = useState("");
const [isDeleting, setIsDeleting] = useState(false);
--
});
}
}, { scope: sectionRef });
useEffect(() => {
const current = roles[roleIndex];
const timeout = setTimeout(
() => {
if (!isDeleting) {
setText(current.slice(0, text.length + 1));
if (text.length + 1 === current.length) {
--
}
} else {
setText(current.slice(0, text.length - 1));
if (text.length === 0) {
setIsDeleting(false);
setRoleIndex((i) => (i + 1) % roles.length);
}
}
},
isDeleting ? 40 : 80
);