-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
71 lines (70 loc) · 2.3 KB
/
Copy pathscript.js
File metadata and controls
71 lines (70 loc) · 2.3 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
const canvas = document.getElementById("particles");
const ctx = canvas.getContext("2d");
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
const dots = [];
const DOT_COUNT = 80;
for (let i = 0; i < DOT_COUNT; i++) {
dots.push({
x: Math.random() * canvas.width,
y: Math.random() * canvas.height,
vx: (Math.random() - 0.5) * 0.3,
vy: (Math.random() - 0.5) * 0.3,
radius: Math.random() * 1.5 + 0.5
});
}
function drawParticles() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
dots.forEach(dot => {
dot.x += dot.vx;
dot.y += dot.vy;
if (dot.x < 0 || dot.x > canvas.width) dot.vx *= -1;
if (dot.y < 0 || dot.y > canvas.height) dot.vy *= -1;
ctx.beginPath();
ctx.arc(dot.x, dot.y, dot.radius, 0, Math.PI * 2);
ctx.fillStyle = "rgba(255, 255, 255, 0.3)";
ctx.fill();
});
requestAnimationFrame(drawParticles);
}
drawParticles();
window.addEventListener("resize", () => {
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
});
const text = "주도적 트러블슈터";
const target = document.getElementById("typing");
let index = 0;
function type() {
if (index < text.length) {
target.textContent = text.substring(0, index + 1);
target.innerHTML += '<span class="cursor">|</span>';
index++;
setTimeout(type, 150);
} else {
document.querySelector("#hero p").classList.add("show");
}
}
type();
document.querySelectorAll(".card").forEach((card, i) => {
card.style.transitionDelay = `${i * 0.15}s`;
});
document.querySelectorAll(".skill-card").forEach((card, i) => {
card.style.transitionDelay = `${i * 0.15}s`;
});
document.querySelectorAll(".project-card").forEach((card, i) => {
card.style.transitionDelay = `${i * 0.15}s`;
});
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add("visible");
}
});
}, {threshold: 0.3 });
document.querySelectorAll(".about-info, .skill-card, .project-card, .mil-info, .card, .mil-award, .cert-card").forEach(el => {
observer.observe(el);
});
document.querySelectorAll(".cert-card").forEach((card, i) => {
card.style.transitionDelay = `${i * 0.15}s`;
});