-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
41 lines (35 loc) · 1.18 KB
/
script.js
File metadata and controls
41 lines (35 loc) · 1.18 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
import { createTimeline, stagger, animate } from 'https://cdn.jsdelivr.net/npm/animejs/+esm';
particlesJS.load('particles-js', 'particlesjs-config.json', function() {
console.log('callback - particles.js config loaded');
})
const textWrapper = document.querySelector('.hero-title');
if (textWrapper) {
textWrapper.innerHTML = textWrapper.textContent.replace(/\S/g, "<span class='letter'>$&</span>");
const tl = createTimeline({loop: false, direction: 'alternate'});
tl.add('.hero-title .letter', {
opacity: [0, 1],
translateY: [-200, 0],
easing: 'easeOutExpo',
duration: 1400,
delay: stagger(70),
});
}
if (document.querySelector('.project-grid')) {
animate('.project-card', {
translateY: [50, 0],
easing: 'easeOutExpo',
opacity: [0, 1],
delay: stagger(100),
});
}
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('visible');
}
});
}, {
threshold: 0.1
});
const revealElements = document.querySelectorAll('.reveal-section');
revealElements.forEach(el => observer.observe(el));