-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
100 lines (84 loc) · 3.26 KB
/
script.js
File metadata and controls
100 lines (84 loc) · 3.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
// Initialize AOS (Animate On Scroll)
AOS.init({ once: true, offset: 50, duration: 800 });
// Mobile Menu Toggle
document.getElementById('mobile-btn').addEventListener('click', () => {
document.getElementById('mobile-menu').classList.toggle('hidden');
});
// Filter Projects
function filterProjects(cat, btn) {
document.querySelectorAll('.filter-btn').forEach(b => {
b.classList.remove('bg-teal-500', 'text-white', 'border-teal-500');
b.classList.add('border-slate-700', 'text-slate-400');
});
btn.classList.remove('border-slate-700', 'text-slate-400');
btn.classList.add('bg-teal-500', 'text-white', 'border-teal-500');
document.querySelectorAll('.project-card').forEach(card => {
if (cat === 'all' || card.classList.contains(cat)) {
card.style.display = 'block';
card.classList.add('aos-animate');
} else {
card.style.display = 'none';
}
});
}
// --- 4-WAY BUBBLE GENERATOR ---
function createBubbles() {
const container = document.getElementById('four-way-bg');
const icons = ['fa-bug', 'fa-bug', 'fa-server', 'fa-docker', 'fa-check-circle', 'fa-code-branch'];
const animations = ['move-up', 'move-down', 'move-left', 'move-right'];
const colors = ['p-bug', 'p-dev', 'p-qa'];
for (let i = 0; i < 25; i++) {
const bubble = document.createElement('i');
const randomIcon = icons[Math.floor(Math.random() * icons.length)];
const randomAnim = animations[Math.floor(Math.random() * animations.length)];
const randomColor = colors[Math.floor(Math.random() * colors.length)];
bubble.classList.add('fas', randomIcon, 'bubble-particle', randomAnim, randomColor);
// Random Positioning
if (randomAnim === 'move-up' || randomAnim === 'move-down') {
bubble.style.left = Math.random() * 90 + 5 + '%';
} else {
bubble.style.top = Math.random() * 90 + 5 + '%';
}
bubble.style.animationDuration = (Math.random() * 3 + 3) + 's';
bubble.style.animationDelay = (Math.random() * 5) + 's';
container.appendChild(bubble);
}
}
// Typing Effect
const textElement = document.getElementById('typed-text');
const phrases = [
"DevOps Engineer",
"DevOps Freelancer",
"CI/CD Pipelines",
"AWS & Docker"
];
let phraseIndex = 0;
let charIndex = 0;
let isDeleting = false;
let typeSpeed = 100;
function typeText() {
const currentPhrase = phrases[phraseIndex];
if (isDeleting) {
textElement.textContent = currentPhrase.substring(0, charIndex - 1);
charIndex--;
typeSpeed = 50;
} else {
textElement.textContent = currentPhrase.substring(0, charIndex + 1);
charIndex++;
typeSpeed = 100;
}
if (!isDeleting && charIndex === currentPhrase.length) {
isDeleting = true;
typeSpeed = 1800;
} else if (isDeleting && charIndex === 0) {
isDeleting = false;
phraseIndex = (phraseIndex + 1) % phrases.length;
typeSpeed = 500;
}
setTimeout(typeText, typeSpeed);
}
// Initialize on DOM Load
document.addEventListener('DOMContentLoaded', () => {
createBubbles();
typeText();
});