-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
209 lines (178 loc) · 6.57 KB
/
script.js
File metadata and controls
209 lines (178 loc) · 6.57 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
// Matrix Rain Effect
function createMatrixRain() {
const canvas = document.getElementById('matrix-canvas');
const chars = '01アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヲン';
const fontSize = 14;
const columns = Math.floor(window.innerWidth / fontSize);
let drops = [];
for (let i = 0; i < columns; i++) {
drops[i] = Math.random() * -100;
}
function draw() {
let matrixHTML = '';
for (let i = 0; i < columns; i++) {
const char = chars[Math.floor(Math.random() * chars.length)];
const x = i * fontSize;
const y = drops[i] * fontSize;
if (y > 0 && y < window.innerHeight) {
matrixHTML += `<span style="position: absolute; left: ${x}px; top: ${y}px; color: rgba(0, 255, 65, ${Math.random() * 0.5 + 0.2}); font-size: ${fontSize}px;">${char}</span>`;
}
if (y > window.innerHeight && Math.random() > 0.975) {
drops[i] = 0;
}
drops[i]++;
}
canvas.innerHTML = matrixHTML;
}
setInterval(draw, 50);
// Recreate on resize
window.addEventListener('resize', () => {
const newColumns = Math.floor(window.innerWidth / fontSize);
if (newColumns !== columns) {
createMatrixRain();
}
});
}
// Typing Animation
function typeCommand() {
const commands = [
'npm run build',
'git commit -m "awesome features"',
'docker-compose up',
'yarn dev',
'make deploy'
];
let commandIndex = 0;
let charIndex = 0;
const typingElement = document.getElementById('typing-command');
function type() {
const currentCommand = commands[commandIndex];
if (charIndex < currentCommand.length) {
typingElement.textContent += currentCommand.charAt(charIndex);
charIndex++;
setTimeout(type, 100 + Math.random() * 100);
} else {
setTimeout(() => {
charIndex = 0;
typingElement.textContent = '';
commandIndex = (commandIndex + 1) % commands.length;
setTimeout(type, 500);
}, 3000);
}
}
type();
}
// Progress Bar Animation
function animateProgress() {
const progressFill = document.getElementById('progress-fill');
const progressPercent = document.getElementById('progress-percent');
let progress = 0;
const target = Math.floor(Math.random() * 30) + 65; // Random between 65-95%
function updateProgress() {
if (progress < target) {
progress += Math.random() * 2;
if (progress > target) progress = target;
progressFill.style.width = progress + '%';
progressPercent.textContent = Math.floor(progress) + '%';
setTimeout(updateProgress, 50);
} else {
// Subtle fluctuation
setInterval(() => {
const fluctuation = (Math.random() - 0.5) * 2;
const newProgress = Math.max(target - 2, Math.min(target + 2, progress + fluctuation));
progressFill.style.width = newProgress + '%';
progressPercent.textContent = Math.floor(newProgress) + '%';
}, 2000);
}
}
setTimeout(updateProgress, 1000);
}
// Form Submission
function handleFormSubmit() {
const form = document.getElementById('notify-form');
const emailInput = document.getElementById('email-input');
const successMessage = document.getElementById('success-message');
form.addEventListener('submit', (e) => {
e.preventDefault();
const email = emailInput.value;
// Here you would normally send the email to your backend
// For now, just show success message
console.log('Email submitted:', email);
// Show success message
successMessage.classList.add('show');
emailInput.value = '';
// Hide message after 5 seconds
setTimeout(() => {
successMessage.classList.remove('show');
}, 5000);
});
}
// Update Social Links (customize these!)
function updateSocialLinks() {
// Update these with your actual social links
const links = {
github: 'https://github.com/programinglive/comingsoon',
twitter: 'https://x.com/moszesaeschylus',
email: 'mailto:mahatma.mahardhika@programinglive.com'
};
document.getElementById('github-link').href = links.github;
document.getElementById('twitter-link').href = links.twitter;
document.getElementById('email-link').href = links.email;
}
// Random Code Snippets in Background
function addFloatingCode() {
const codeSnippets = [
'const promise = new Promise();',
'async function init() {...}',
'import { Component } from "react"',
'while (true) { code(); }',
'export default App;',
'// TODO: Make it awesome'
];
setInterval(() => {
const snippet = document.createElement('div');
snippet.textContent = codeSnippets[Math.floor(Math.random() * codeSnippets.length)];
snippet.style.cssText = `
position: fixed;
left: ${Math.random() * 100}%;
top: ${Math.random() * 100}%;
color: rgba(0, 255, 65, 0.1);
font-size: ${Math.random() * 10 + 10}px;
pointer-events: none;
z-index: 0;
font-family: 'JetBrains Mono', monospace;
transform: rotate(${Math.random() * 360}deg);
`;
document.body.appendChild(snippet);
setTimeout(() => snippet.remove(), 5000);
}, 3000);
}
// Initialize everything
document.addEventListener('DOMContentLoaded', () => {
createMatrixRain();
typeCommand();
animateProgress();
handleFormSubmit();
updateSocialLinks();
addFloatingCode();
// Add glitch effect on hover to ASCII art
const asciiArt = document.querySelector('.ascii-art');
asciiArt.addEventListener('mouseenter', function () {
this.style.animation = 'glitch 0.3s ease';
});
asciiArt.addEventListener('animationend', function () {
this.style.animation = '';
});
});
// Add glitch animation
const style = document.createElement('style');
style.textContent = `
@keyframes glitch {
0%, 100% { transform: translate(0); }
20% { transform: translate(-2px, 2px); }
40% { transform: translate(-2px, -2px); }
60% { transform: translate(2px, 2px); }
80% { transform: translate(2px, -2px); }
}
`;
document.head.appendChild(style);