Spaces:
Running
Running
Delete script.js
Browse files
script.js
DELETED
@@ -1,75 +0,0 @@
|
|
1 |
-
// script.js
|
2 |
-
|
3 |
-
// ππ Dark/Light Mode Toggle Functionality
|
4 |
-
const darkModeToggle = document.getElementById('darkModeToggle');
|
5 |
-
const body = document.body;
|
6 |
-
|
7 |
-
darkModeToggle.addEventListener('click', () => {
|
8 |
-
body.classList.toggle('light-mode');
|
9 |
-
darkModeToggle.textContent = body.classList.contains('light-mode') ? 'π' : 'π';
|
10 |
-
});
|
11 |
-
|
12 |
-
// β¨ Custom Cursor Functionality
|
13 |
-
const cursor = document.querySelector('.custom-cursor');
|
14 |
-
const bodyElement = document.body;
|
15 |
-
|
16 |
-
bodyElement.addEventListener('mousemove', e => {
|
17 |
-
cursor.style.transform = `translate3d(${e.clientX}px, ${e.clientY}px, 0)`;
|
18 |
-
});
|
19 |
-
|
20 |
-
bodyElement.addEventListener('mousedown', () => {
|
21 |
-
cursor.classList.add('cursor-click');
|
22 |
-
const clickEffect = document.createElement('div');
|
23 |
-
clickEffect.classList.add('click-effect');
|
24 |
-
clickEffect.style.left = `${event.clientX}px`;
|
25 |
-
clickEffect.style.top = `${event.clientY}px`;
|
26 |
-
document.body.appendChild(clickEffect);
|
27 |
-
setTimeout(() => {
|
28 |
-
clickEffect.remove();
|
29 |
-
}, 500);
|
30 |
-
});
|
31 |
-
|
32 |
-
bodyElement.addEventListener('mouseup', () => {
|
33 |
-
cursor.classList.remove('cursor-click');
|
34 |
-
});
|
35 |
-
|
36 |
-
// π¦Έ Hero Section Live Typing Effect
|
37 |
-
const typedTextSpan = document.querySelector(".typed-text");
|
38 |
-
const cursorSpan = document.querySelector(".cursor");
|
39 |
-
|
40 |
-
const textArray = ["GENERATIVE AI & DATA SCIENCE ENGINEER", "PROMPT ENGINEER", "AI DEVELOPER"];
|
41 |
-
const typingDelay = 100;
|
42 |
-
const erasingDelay = 50;
|
43 |
-
const newTextDelay = 2000; // Delay between current text and next text
|
44 |
-
let textArrayIndex = 0;
|
45 |
-
let charIndex = 0;
|
46 |
-
|
47 |
-
function type() {
|
48 |
-
if (charIndex < textArray[textArrayIndex].length) {
|
49 |
-
typedTextSpan.textContent += textArray[textArrayIndex].charAt(charIndex);
|
50 |
-
charIndex++;
|
51 |
-
setTimeout(type, typingDelay);
|
52 |
-
} else {
|
53 |
-
// Typing finished, start erasing
|
54 |
-
setTimeout(erase, newTextDelay);
|
55 |
-
}
|
56 |
-
}
|
57 |
-
|
58 |
-
function erase() {
|
59 |
-
if (charIndex > 0) {
|
60 |
-
typedTextSpan.textContent = textArray[textArrayIndex].substring(0, charIndex - 1);
|
61 |
-
charIndex--;
|
62 |
-
setTimeout(erase, erasingDelay);
|
63 |
-
} else {
|
64 |
-
// Erasing finished, move to the next text
|
65 |
-
textArrayIndex++;
|
66 |
-
if (textArrayIndex >= textArray.length) textArrayIndex = 0;
|
67 |
-
setTimeout(type, typingDelay + 1100);
|
68 |
-
}
|
69 |
-
}
|
70 |
-
|
71 |
-
document.addEventListener("DOMContentLoaded", () => {
|
72 |
-
if (textArray.length) setTimeout(type, newTextDelay + 250);
|
73 |
-
});
|
74 |
-
|
75 |
-
// β¨ Floating Particles (Initialized in the <script> tag in HTML)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|