-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
31 lines (26 loc) · 933 Bytes
/
script.js
File metadata and controls
31 lines (26 loc) · 933 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
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('show');
}
});
});
document.querySelectorAll('.skill-card, .project-card').forEach((el) => {
el.classList.add('hidden');
observer.observe(el);
});
document.getElementById('year').textContent = new Date().getFullYear();
document.querySelectorAll('.project-card').forEach(card => {
card.addEventListener('mousemove', (e) => {
const x = e.pageX - card.offsetLeft;
const y = e.pageY - card.offsetTop;
card.style.transform = `
perspective(1000px)
rotateX(${(y - card.offsetHeight/2) / 10}deg)
rotateY(${-(x - card.offsetWidth/2) / 10}deg)
`;
});
card.addEventListener('mouseleave', () => {
card.style.transform = 'none';
});
});