-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
181 lines (164 loc) · 4.05 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hacker Terminal</title>
<style>
body {
margin: 0;
padding: 0;
overflow: hidden;
background-color: black;
font-family: 'Courier New', Courier, monospace;
color: limegreen;
line-height: 1.2; /* Reduced line-height */
}
canvas {
display: block;
}
#terminal {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
padding: 20px;
overflow-y: auto;
background-color: rgba(0, 0, 0, 0.5); /* Transparent background */
z-index: 1;
}
#output {
margin: 0;
padding: 0;
}
/* Media query for small screens */
@media only screen and (max-width: 600px) {
body {
font-size: 14px;
}
}
</style>
</head>
<body>
<div id="terminal">
<pre id="output"></pre>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.4.0/p5.js"></script>
<script>
let drops = [];
function setup() {
createCanvas(windowWidth, windowHeight);
for (let i = 0; i < 300; i++) {
drops.push(new Drop());
}
}
function draw() {
background(0);
for (let drop of drops) {
drop.update();
drop.display();
}
}
class Drop {
constructor() {
this.x = random(width);
this.y = random(-500, -50);
this.speed = random(1, 10);
this.len = random(10, 50);
}
update() {
this.y += this.speed;
if (this.y > height) {
this.y = random(-200, -100);
}
}
display() {
let binary = floor(random(2));
fill(0, 255, 0);
textSize(10);
text(binary, this.x, this.y);
}
}
// Simulating Hacker Terminal Text
let output = document.getElementById('output');
let texts = [
"Connecting to server...",
"Downloading files...",
"Decrypting security protocols...",
"Access granted. Welcome, Hacker!",
"Executing source code...",
"Penetrating into JavaScript code...",
"Mission accomplished."
];
let jsCode = `
let drops = [];
function setup() {
createCanvas(windowWidth, windowHeight);
for (let i = 0; i < 100; i++) {
drops.push(new Drop());
}
}
function draw() {
background(0);
for (let drop of drops) {
drop.update();
drop.display();
}
}
class Drop {
constructor() {
this.x = random(width);
this.y = random(-500, -50);
this.speed = random(1, 10);
this.len = random(10, 30);
}
update() {
this.y += this.speed;
if (this.y > height) {
this.y = random(-200, -100);
}
}
display() {
let binary = floor(random(2));
fill(0, 255, 0);
textSize(20);
text(binary, this.x, this.y);
}
}
`;
function typeCode() {
return new Promise(resolve => {
let index = 0;
let codeInterval = setInterval(() => {
output.innerHTML += '<span style="color: royalblue; font-size: 7px; line-height: 1;">' + jsCode[index] + '</span>';
output.scrollTop = output.scrollHeight;
index++;
if (index === jsCode.length) {
clearInterval(codeInterval);
resolve();
}
}, 50);
});
}
async function simulateTerminal() {
for (let i = 0; i < texts.length; i++) {
await new Promise(resolve => {
setTimeout(() => {
output.innerHTML += texts[i] + '\n';
output.scrollTop = output.scrollHeight;
if (i === texts.length - 1) {
typeCode().then(() => {
output.innerHTML += '\n';
output.scrollTop = output.scrollHeight;
});
}
resolve();
}, 2000 * i);
});
}
}
simulateTerminal();
</script>
</body>
</html>