-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
57 lines (52 loc) · 1.26 KB
/
Copy pathscript.js
File metadata and controls
57 lines (52 loc) · 1.26 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Typing effect for hero
const phrases = [
'Reliable.',
'clean APIs.',
'Pipelines.',
'Scalable.',
'Secure.'
];
const el = document.getElementById('typed');
let pIdx = 0;
let cIdx = 0;
let deleting = false;
function tick() {
if (!el) return;
const word = phrases[pIdx];
el.textContent = word.slice(0, cIdx);
if (!deleting && cIdx < word.length) {
cIdx++;
setTimeout(tick, 70);
} else if (deleting && cIdx > 0) {
cIdx--;
setTimeout(tick, 35);
} else {
deleting = !deleting;
if (!deleting) pIdx = (pIdx + 1) % phrases.length;
setTimeout(tick, deleting ? 1400 : 300);
}
}
tick();
// Year in footer
const yEl = document.getElementById('year');
if (yEl) yEl.textContent = new Date().getFullYear();
// Reveal sections on scroll
const sections = document.querySelectorAll('.section');
const io = new IntersectionObserver(
(entries) => {
entries.forEach((e) => {
if (e.isIntersecting) {
e.target.style.opacity = '1';
e.target.style.transform = 'translateY(0)';
io.unobserve(e.target);
}
});
},
{ threshold: 0.1 }
);
sections.forEach((s) => {
s.style.opacity = '0';
s.style.transform = 'translateY(20px)';
s.style.transition = 'opacity 0.6s ease, transform 0.6s ease';
io.observe(s);
});