-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
74 lines (46 loc) · 1.45 KB
/
Copy pathscript.js
File metadata and controls
74 lines (46 loc) · 1.45 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// Smooth Fade-In Animation
const observer = new IntersectionObserver((entries)=>{
entries.forEach(entry=>{
if(entry.isIntersecting){
entry.target.classList.add("show");
}
});
});
document.querySelectorAll("section").forEach(section=>{
section.classList.add("hidden");
observer.observe(section);
});
// Create Background Particles
const particles = 40;
for(let i=0;i<particles;i++){
const particle = document.createElement("div");
particle.classList.add("particle");
particle.style.left = Math.random()*100 + "vw";
particle.style.animationDuration =
10 + Math.random()*10 + "s";
particle.style.animationDelay =
Math.random()*5 + "s";
particle.style.opacity =
Math.random();
particle.style.width =
2 + Math.random()*4 + "px";
particle.style.height =
particle.style.width;
document.body.appendChild(particle);
}
// Card Hover Glow
document.querySelectorAll(".card").forEach(card=>{
card.addEventListener("mousemove",(e)=>{
const rect = card.getBoundingClientRect();
const x = e.clientX - rect.left;
const y = e.clientY - rect.top;
card.style.background =
`radial-gradient(circle at ${x}px ${y}px,
rgba(110,231,183,0.15),
rgba(255,255,255,0.05))`;
});
card.addEventListener("mouseleave",()=>{
card.style.background =
"rgba(255,255,255,0.05)";
});
});