-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
95 lines (75 loc) · 2.47 KB
/
script.js
File metadata and controls
95 lines (75 loc) · 2.47 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
// Smooth scrolling
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener("click", function(e) {
e.preventDefault();
document.querySelector(this.getAttribute("href")).scrollIntoView({
behavior: "smooth"
});
});
});
// ASCII flowing background
const canvas = document.getElementById("asciiCanvas");
const ctx = canvas.getContext("2d");
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
const symbols = "01#$%&@";
let drops = [];
for (let i = 0; i < canvas.width / 10; i++) {
drops[i] = 1;
}
function draw() {
ctx.fillStyle = "rgba(0, 0, 40, 0.07)";
ctx.fillRect(0, 0, canvas.width, canvas.height);
ctx.fillStyle = "#00aaff";
ctx.font = "15px monospace";
for (let i = 0; i < drops.length; i++) {
const text = symbols[Math.floor(Math.random() * symbols.length)];
ctx.fillText(text, i * 10, drops[i] * 20);
if (drops[i] * 20 > canvas.height && Math.random() > 0.95) {
drops[i] = 0;
}
drops[i]++;
}
}
setInterval(draw, 50);
window.addEventListener("resize", () => {
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
});
const text = `Hello, I'm SgtAzureDev\n
Cybersecurity Enthusiast • Developer • Learner`;
let i = 0;
const speed = 45;
const el = document.getElementById("glitch-text");
const glitchContainer = document.querySelector(".glitch-type");
function type() {
if (i < text.length) {
const char = text[i];
if (char === "\n") {
el.innerHTML += "<br>";
} else {
el.innerHTML += char;
}
glitchContainer.setAttribute("data-text", el.innerText);
i++;
setTimeout(type, speed);
} else {
// soft micro-glitch pulses
setInterval(() => {
glitchContainer.style.filter = "blur(0.6px)";
setTimeout(() => glitchContainer.style.filter = "blur(0px)", 120);
}, 2000);
}
}
type();
document.getElementById("contactForm").addEventListener("submit", function(e) {
e.preventDefault();
emailjs.sendForm("service_tw7zpzp", "template_gb2xduh", this) /* Your Service ID and Template ID */
.then(() => {
alert("Message sent successfully!");
document.getElementById("contactForm").reset(); // Clear form after submission
})
.catch((error) => {
alert("Failed to send message.\n" + JSON.stringify(error));
});
});