-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
39 lines (35 loc) · 1.08 KB
/
script.js
File metadata and controls
39 lines (35 loc) · 1.08 KB
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
const animatedElements = document.querySelectorAll(".upSlide, .leftSlide, .rightSlide, .imageSlide, .logoSlide, .profileSlide, .projectCard, .experienceCard");
const splashTitles =
[
"Software Developer",
"Game Developer",
"Competitive Programmer",
"Bonsai Enthusiast",
"Avid Linguist",
"Cat Dad",
];
const value = document.getElementById("splashTextRotate");
let index = 0;
setInterval(() => {
value.style.opacity = 0;
setTimeout(() => {
index = (index + 1) % splashTitles.length;
value.textContent = splashTitles[index];
value.style.opacity = 1;
}, 250); // wait for fade-out before updating
}, 1500); // total time = fade + display
// Set up an IntersectionObserver to detect when a section scrolls into view
const observer = new IntersectionObserver(
(entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add("show");
}
});
},
{
threshold: 0.10 // Trigger when 10% of the section is visible
}
);
// Observe each section
animatedElements.forEach(el => observer.observe(el));