-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinteractive_ASCII_Video.html
More file actions
207 lines (178 loc) · 6.54 KB
/
Copy pathinteractive_ASCII_Video.html
File metadata and controls
207 lines (178 loc) · 6.54 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>NEURAL_SCANNER_v2.0</title>
<style>
body {
margin: 0;
background: #020205;
overflow: hidden;
font-family: 'Segoe UI', sans-serif;
cursor: crosshair;
}
canvas {
display: block;
filter: saturate(1.5) brightness(1.2);
}
/* High-Tech HUD Elements */
#hud-container {
position: absolute;
inset: 0;
pointer-events: none;
border: 20px solid rgba(0, 255, 255, 0.05);
z-index: 10;
}
.hud-corner {
position: absolute;
width: 40px;
height: 40px;
border: 2px solid #00f2ff;
}
.top-left { top: 20px; left: 20px; border-right: 0; border-bottom: 0; }
.top-right { top: 20px; right: 20px; border-left: 0; border-bottom: 0; }
.bottom-left { bottom: 20px; left: 20px; border-right: 0; border-top: 0; }
.bottom-right { bottom: 20px; right: 20px; border-left: 0; border-top: 0; }
#data-readout {
position: absolute;
bottom: 40px;
left: 40px;
color: #00f2ff;
font-family: monospace;
font-size: 10px;
letter-spacing: 2px;
text-shadow: 0 0 10px #00f2ff;
}
#init-screen {
position: fixed;
inset: 0;
background: #000;
display: flex;
align-items: center;
justify-content: center;
z-index: 100;
}
button {
background: transparent;
color: #00f2ff;
border: 1px solid #00f2ff;
padding: 20px 40px;
font-family: monospace;
font-size: 1rem;
cursor: pointer;
transition: 0.3s;
text-transform: uppercase;
}
button:hover {
background: rgba(0, 242, 255, 0.1);
box-shadow: 0 0 30px rgba(0, 242, 255, 0.3);
}
/* The Moving Scanline */
.scan-bar {
position: absolute;
width: 100%;
height: 4px;
background: rgba(0, 242, 255, 0.5);
box-shadow: 0 0 20px #00f2ff;
top: -10px;
animation: scan 4s linear infinite;
}
@keyframes scan {
0% { top: 0%; }
100% { top: 100%; }
}
</style>
</head>
<body>
<div id="init-screen">
<button id="start-btn">Initialize Neural Link</button>
</div>
<div id="hud-container">
<div class="hud-corner top-left"></div>
<div class="hud-corner top-right"></div>
<div class="hud-corner bottom-left"></div>
<div class="hud-corner bottom-right"></div>
<div class="scan-bar"></div>
<div id="data-readout">
LINK: ESTABLISHED<br>
THREAT_DETECTION: ACTIVE<br>
BIO_SCAN: <span id="bio-val">...</span>
</div>
</div>
<canvas id="canvas"></canvas>
<script>
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d', { alpha: false });
const startBtn = document.getElementById('start-btn');
const initScreen = document.getElementById('init-screen');
const bioReadout = document.getElementById('bio-val');
let video = document.createElement('video');
let width, height;
let particles = [];
function init() {
width = canvas.width = window.innerWidth;
height = canvas.height = window.innerHeight;
}
startBtn.onclick = () => {
navigator.mediaDevices.getUserMedia({ video: true })
.then(stream => {
video.srcObject = stream;
video.play();
initScreen.style.display = 'none';
init();
requestAnimationFrame(update);
});
};
function update() {
// Draw current frame to hidden small scale for calculation
const offscreen = document.createElement('canvas');
const osCtx = offscreen.getContext('2d');
offscreen.width = 160;
offscreen.height = 120;
// Mirror mode
osCtx.translate(offscreen.width, 0);
osCtx.scale(-1, 1);
osCtx.drawImage(video, 0, 0, offscreen.width, offscreen.height);
const imageData = osCtx.getImageData(0, 0, offscreen.width, offscreen.height);
const data = imageData.data;
// Background "Ghosting" effect (Don't clear fully)
ctx.fillStyle = 'rgba(2, 2, 5, 0.15)';
ctx.fillRect(0, 0, width, height);
const stepX = width / offscreen.width;
const stepY = height / offscreen.height;
// Neural Edge Detection Logic
for (let y = 0; y < offscreen.height; y++) {
for (let x = 0; x < offscreen.width; x++) {
const i = (y * offscreen.width + x) * 4;
const r = data[i];
const g = data[i + 1];
const b = data[i + 2];
const brightness = (r + g + b) / 3;
// Only draw high-contrast "edges" or highlights
if (brightness > 120) {
const posX = x * stepX;
const posY = y * stepY;
// Draw Neon Rectangles instead of ASCII
ctx.beginPath();
ctx.strokeStyle = `hsla(${180 + brightness/4}, 100%, 50%, ${brightness/255})`;
ctx.lineWidth = 0.5;
// Cyberpunk "Box" Geometry
if (Math.random() > 0.95) {
ctx.strokeRect(posX, posY, brightness / 10, brightness / 10);
} else {
ctx.moveTo(posX, posY);
ctx.lineTo(posX + 10, posY);
}
ctx.stroke();
}
}
}
// Random Data Flicker
if(Math.random() > 0.9) bioReadout.innerText = (Math.random() * 100).toFixed(2) + "% SYNC";
requestAnimationFrame(update);
}
window.onresize = init;
</script>
</body>
</html>