Derur commited on
Commit
3bb8cb9
·
verified ·
1 Parent(s): 7b14fb5

Upload 14 files

Browse files
.gitattributes CHANGED
@@ -195,3 +195,4 @@ NeuroDonu/PortableSource(for[[:space:]]portables)/aria2c.exe filter=lfs diff=lfs
195
  NeuroDonu/PortableSource(for[[:space:]]portables)/onnxruntime_providers_cuda.dll filter=lfs diff=lfs merge=lfs -text
196
  NeuroDonu/PortableSource(for[[:space:]]portables)/onnxruntime_providers_tensorrt.dll filter=lfs diff=lfs merge=lfs -text
197
  HZ/База[[:space:]]знаний[[:space:]]SD.xlsx filter=lfs diff=lfs merge=lfs -text
 
 
195
  NeuroDonu/PortableSource(for[[:space:]]portables)/onnxruntime_providers_cuda.dll filter=lfs diff=lfs merge=lfs -text
196
  NeuroDonu/PortableSource(for[[:space:]]portables)/onnxruntime_providers_tensorrt.dll filter=lfs diff=lfs merge=lfs -text
197
  HZ/База[[:space:]]знаний[[:space:]]SD.xlsx filter=lfs diff=lfs merge=lfs -text
198
+ NeuroPort/HTML+APPS/imagefix.exe filter=lfs diff=lfs merge=lfs -text
NeuroPort/HTML+APPS/AudioFileComparison.html ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="ru">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Сравнение аудиофайлов</title>
7
+ <script src="https://cdn.jsdelivr.net/npm/wavesurfer.js"></script>
8
+ <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
9
+ <style>
10
+ body { font-family: Arial, sans-serif; text-align: center; }
11
+ .waveform-container { display: flex; flex-direction: column; align-items: center; gap: 20px; }
12
+ .waveform { width: 80%; }
13
+ .waveform div { height: 150px; cursor: pointer; }
14
+ .chart-container { width: 80%; margin: auto; }
15
+ .audio-controls { margin-top: 20px; }
16
+ </style>
17
+ </head>
18
+ <body>
19
+ <h2>Сравнение двух аудиофайлов</h2>
20
+ <p>Нажмите <strong>1</strong> для воспроизведения первого трека, <strong>2</strong> для второго.</p>
21
+ <input type="file" id="file1" accept="audio/*" onchange="updateLabel(1)">
22
+ <input type="file" id="file2" accept="audio/*" onchange="updateLabel(2)">
23
+ <button onclick="analyzeAudio()">Анализировать</button>
24
+
25
+ <div class="waveform-container">
26
+ <div class="waveform">
27
+ <h3 id="track1-label">Файл 1</h3>
28
+ <div id="waveform1"></div>
29
+ <p id="time1">Время: 0:00</p>
30
+ <p id="rms1">RMS: -</p>
31
+ <p id="lufs1">LUFS: -</p>
32
+ <button onclick="playAudio(1)" style="font-size: 2em;">▶️/⏸</button>
33
+ </div>
34
+ <div class="waveform">
35
+ <h3 id="track2-label">Файл 2</h3>
36
+ <div id="waveform2"></div>
37
+ <p id="time2">Время: 0:00</p>
38
+ <p id="rms2">RMS: -</p>
39
+ <p id="lufs2">LUFS: -</p>
40
+ <button onclick="playAudio(2)" style="font-size: 2em;">▶️/⏸</button>
41
+ </div>
42
+ </div>
43
+
44
+ <canvas id="histogramChart"></canvas>
45
+ <canvas id="spectrumChart"></canvas>
46
+
47
+ <script>
48
+ let wavesurfer1, wavesurfer2;
49
+
50
+ document.addEventListener('keydown', function(event) {
51
+ if (event.key === '1') {
52
+ playAudio(1);
53
+ } else if (event.key === '2') {
54
+ playAudio(2);
55
+ }
56
+ });
57
+
58
+ function updateLabel(track) {
59
+ const fileInput = document.getElementById(`file${track}`);
60
+ const label = document.getElementById(`track${track}-label`);
61
+ label.textContent = fileInput.files[0] ? fileInput.files[0].name : `Файл ${track}`;
62
+ }
63
+
64
+ function analyzeAudio() {
65
+ const file1 = document.getElementById('file1').files[0];
66
+ const file2 = document.getElementById('file2').files[0];
67
+ if (!file1 || !file2) {
68
+ alert('Выберите два аудиофайла!');
69
+ return;
70
+ }
71
+
72
+ wavesurfer1 = WaveSurfer.create({ container: '#waveform1', waveColor: 'blue', progressColor: 'darkblue', height: 150 });
73
+ wavesurfer2 = WaveSurfer.create({ container: '#waveform2', waveColor: 'red', progressColor: 'darkred', height: 150 });
74
+
75
+ const url1 = URL.createObjectURL(file1);
76
+ const url2 = URL.createObjectURL(file2);
77
+
78
+ wavesurfer1.load(url1);
79
+ wavesurfer2.load(url2);
80
+
81
+ wavesurfer1.on('seek', syncSeek);
82
+ wavesurfer2.on('seek', syncSeek);
83
+ wavesurfer1.on('audioprocess', () => updateTime(1));
84
+ wavesurfer2.on('audioprocess', () => updateTime(2));
85
+
86
+ calculateLoudness(file1, 'rms1', 'lufs1');
87
+ calculateLoudness(file2, 'rms2', 'lufs2');
88
+ }
89
+
90
+ function playAudio(track) {
91
+ let otherWavesurfer = track === 1 ? wavesurfer2 : wavesurfer1;
92
+ let currentWavesurfer = track === 1 ? wavesurfer1 : wavesurfer2;
93
+
94
+ let currentTime = otherWavesurfer.getCurrentTime();
95
+ otherWavesurfer.pause();
96
+ currentWavesurfer.seekTo(currentTime / currentWavesurfer.getDuration());
97
+ currentWavesurfer.playPause();
98
+ }
99
+
100
+ function syncSeek() {
101
+ let time1 = wavesurfer1.getCurrentTime();
102
+ let time2 = wavesurfer2.getCurrentTime();
103
+ let avgTime = (time1 + time2) / 2;
104
+
105
+ wavesurfer1.seekTo(avgTime / wavesurfer1.getDuration());
106
+ wavesurfer2.seekTo(avgTime / wavesurfer2.getDuration());
107
+ }
108
+
109
+ function updateTime(track) {
110
+ let wavesurfer = track === 1 ? wavesurfer1 : wavesurfer2;
111
+ let timeElement = document.getElementById(`time${track}`);
112
+ let currentTime = wavesurfer.getCurrentTime();
113
+ timeElement.textContent = `Время: ${formatTime(currentTime)}`;
114
+ }
115
+
116
+ function formatTime(seconds) {
117
+ const minutes = Math.floor(seconds / 60);
118
+ const secs = Math.floor(seconds % 60);
119
+ return `${minutes}:${secs < 10 ? '0' : ''}${secs}`;
120
+ }
121
+
122
+ function calculateLoudness(file, rmsElementId, lufsElementId) {
123
+ const reader = new FileReader();
124
+ reader.readAsArrayBuffer(file);
125
+ reader.onload = function(event) {
126
+ const audioContext = new (window.AudioContext || window.webkitAudioContext)();
127
+ audioContext.decodeAudioData(event.target.result, function(buffer) {
128
+ let data = buffer.getChannelData(0);
129
+ let sum = 0;
130
+ for (let i = 0; i < data.length; i++) {
131
+ sum += data[i] * data[i];
132
+ }
133
+ let rms = Math.sqrt(sum / data.length);
134
+ document.getElementById(rmsElementId).textContent = `RMS: ${rms.toFixed(6)}`;
135
+
136
+ let lufs = 20 * Math.log10(rms);
137
+ document.getElementById(lufsElementId).textContent = `LUFS: ${lufs.toFixed(2)}`;
138
+ });
139
+ };
140
+ }
141
+ </script>
142
+ </body>
143
+ </html>
NeuroPort/HTML+APPS/Image Compare.html ADDED
@@ -0,0 +1,272 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Image Comparison Tool</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <style>
9
+ @keyframes pulse {
10
+ 0%, 100% { opacity: 1; }
11
+ 50% { opacity: 0.5; }
12
+ }
13
+ .animate-pulse {
14
+ animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
15
+ }
16
+ .bg-radial-gradient {
17
+ background-image: radial-gradient(circle at 50% 50%, rgba(76,29,149,0.3) 0%, rgba(0,0,0,0) 100%);
18
+ }
19
+ </style>
20
+ </head>
21
+ <body class="bg-gradient-to-b from-purple-900 to-black text-white min-h-screen">
22
+ <div class="w-full h-screen flex flex-col">
23
+ <div id="app" class="relative z-10 p-4 flex-1 flex flex-col">
24
+ <!-- Добавлен фон с градиентом -->
25
+ <div class="absolute inset-0 bg-black opacity-50">
26
+ <div class="absolute inset-0 bg-radial-gradient animate-pulse"></div>
27
+ </div>
28
+
29
+ <!-- Контент -->
30
+ <div class="relative">
31
+ <h1 class="text-3xl font-bold mb-4">🖼️ Image Compare</h1>
32
+ <p class="text-purple-300 mb-6">Система для сравнения изображений</p>
33
+
34
+ <!-- Секция автора -->
35
+ <div class="mb-6 space-y-2">
36
+ <h2 class="text-xl text-purple-200 mb-2">Автор:</h2>
37
+ <div>
38
+ <a href="https://t.me/neuro_art0" class="text-purple-400 hover:text-purple-300 transition-colors duration-300"
39
+ target="_blank" rel="noopener">Nerual Dreming</a> — Основатель
40
+ <a href="https://artgeneration.me/" class="text-purple-400 hover:text-purple-300 transition-colors duration-300"
41
+ target="_blank" rel="noopener">ArtGeneration.me</a>, техноблогер и нейро-евангелист
42
+ </div>
43
+ </div>
44
+
45
+ <p class="text-purple-300 mb-6">
46
+ Загрузите два изображения для сравнения. Используйте колесо мыши для приближения/отдаления и перетаскивание для позиционирования.
47
+ </p>
48
+
49
+ <!-- Поля загрузки файлов -->
50
+ <div class="mt-4 flex gap-4">
51
+ <div class="flex-1">
52
+ <label class="block text-sm font-medium mb-2 text-purple-300">Первое изображение</label>
53
+ <input type="file" id="beforeInput" accept="image/*"
54
+ class="block w-full text-sm text-purple-300 file:mr-4 file:py-2 file:px-4 file:rounded-full file:border-0 file:text-sm file:font-semibold file:bg-purple-500 file:text-white hover:file:bg-purple-400 file:transition-colors file:duration-200">
55
+ </div>
56
+ <div class="flex-1">
57
+ <label class="block text-sm font-medium mb-2 text-purple-300">Второе изображение</label>
58
+ <input type="file" id="afterInput" accept="image/*"
59
+ class="block w-full text-sm text-purple-300 file:mr-4 file:py-2 file:px-4 file:rounded-full file:border-0 file:text-sm file:font-semibold file:bg-purple-500 file:text-white hover:file:bg-purple-400 file:transition-colors file:duration-200">
60
+ </div>
61
+ </div>
62
+ </div>
63
+
64
+ <!-- Контейнер для сравнения -->
65
+ <div id="compareContainer" class="flex-1 relative w-full overflow-hidden bg-gray-900 bg-opacity-50 mt-4"
66
+ style="display: none;">
67
+ <!-- Метаданные -->
68
+ <div class="absolute top-0 left-0 right-0 z-20 flex justify-between bg-black bg-opacity-50 backdrop-blur-sm px-4 py-2">
69
+ <div class="flex flex-col">
70
+ <span id="beforeFileName" class="text-purple-200 font-medium"></span>
71
+ <span id="beforeMetadata" class="text-purple-300 text-sm"></span>
72
+ </div>
73
+ <div class="flex flex-col items-end">
74
+ <span id="afterFileName" class="text-purple-200 font-medium"></span>
75
+ <span id="afterMetadata" class="text-purple-300 text-sm"></span>
76
+ </div>
77
+ </div>
78
+
79
+ <!-- Изображения -->
80
+ <div id="imageContainer" class="absolute inset-0">
81
+ <div id="afterImage" class="absolute inset-0 bg-contain bg-center bg-no-repeat"></div>
82
+ <div id="beforeImage" class="absolute inset-0 bg-contain bg-center bg-no-repeat"
83
+ style="mask-image: linear-gradient(to right, black 50%, transparent 50%); -webkit-mask-image: linear-gradient(to right, black 50%, transparent 50%);"></div>
84
+ </div>
85
+
86
+ <!-- Слайдер -->
87
+ <div id="slider" class="absolute top-0 bottom-0 w-0.5 bg-purple-400 cursor-ew-resize z-10" style="left: 50%">
88
+ <div class="slider-handle absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2
89
+ w-8 h-8 bg-gray-900 rounded-full shadow-lg flex items-center justify-center
90
+ border-2 border-purple-400 cursor-ew-resize hover:shadow-purple-400/50">
91
+ <svg class="w-6 h-6 text-purple-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
92
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"/>
93
+ </svg>
94
+ </div>
95
+ </div>
96
+ </div>
97
+
98
+ <!-- Placeholder -->
99
+ <div id="placeholder" class="flex-1 w-full border border-dashed border-purple-500/30 flex items-center justify-center bg-gray-900/20">
100
+ <div class="text-center space-y-4">
101
+ <div class="w-24 h-24 mx-auto mb-4 rounded-full bg-purple-500/20 flex items-center justify-center animate-pulse">
102
+ <svg class="w-12 h-12 text-purple-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
103
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
104
+ d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"/>
105
+ </svg>
106
+ </div>
107
+ <p class="text-xl font-medium text-purple-300">Загрузите оба изображения для сравнения</p>
108
+ <p class="text-purple-400">Используйте колесо мыши для масштабирования и перетаскивание для перемещения</p>
109
+ </div>
110
+ </div>
111
+ </div>
112
+ </div>
113
+
114
+ <script>
115
+ let state = {
116
+ beforeImage: null,
117
+ afterImage: null,
118
+ beforeFileName: '',
119
+ afterFileName: '',
120
+ beforeMetadata: null,
121
+ afterMetadata: null,
122
+ sliderPosition: 50,
123
+ isDragging: false,
124
+ isMoving: false,
125
+ position: { x: 0, y: 0 },
126
+ zoom: 1,
127
+ lastPosition: { x: 0, y: 0 }
128
+ };
129
+
130
+ function formatFileSize(bytes) {
131
+ if (bytes < 1024) return bytes + ' B';
132
+ if (bytes < 1024 * 1024) return (bytes / 1024).toFixed(1) + ' KB';
133
+ return (bytes / (1024 * 1024)).toFixed(1) + ' MB';
134
+ }
135
+
136
+ async function getImageMetadata(file, url) {
137
+ return new Promise(resolve => {
138
+ const img = new Image();
139
+ img.onload = () => {
140
+ resolve({
141
+ width: img.width,
142
+ height: img.height,
143
+ size: formatFileSize(file.size)
144
+ });
145
+ };
146
+ img.src = url;
147
+ });
148
+ }
149
+
150
+ async function handleImageUpload(e, type) {
151
+ const file = e.target.files[0];
152
+ if (!file) return;
153
+
154
+ const reader = new FileReader();
155
+ reader.onload = async (e) => {
156
+ const imageUrl = e.target.result;
157
+ const metadata = await getImageMetadata(file, imageUrl);
158
+
159
+ if (type === 'before') {
160
+ state.beforeImage = imageUrl;
161
+ state.beforeFileName = file.name;
162
+ state.beforeMetadata = metadata;
163
+ document.getElementById('beforeFileName').textContent = file.name;
164
+ document.getElementById('beforeMetadata').textContent =
165
+ `${metadata.width}x${metadata.height}px • ${metadata.size}`;
166
+ } else {
167
+ state.afterImage = imageUrl;
168
+ state.afterFileName = file.name;
169
+ state.afterMetadata = metadata;
170
+ document.getElementById('afterFileName').textContent = file.name;
171
+ document.getElementById('afterMetadata').textContent =
172
+ `${metadata.width}x${metadata.height}px • ${metadata.size}`;
173
+ }
174
+
175
+ updateUI();
176
+ };
177
+ reader.readAsDataURL(file);
178
+ }
179
+
180
+ function updateUI() {
181
+ const container = document.getElementById('compareContainer');
182
+ const placeholder = document.getElementById('placeholder');
183
+
184
+ if (state.beforeImage && state.afterImage) {
185
+ container.style.display = 'block';
186
+ placeholder.style.display = 'none';
187
+
188
+ document.getElementById('beforeImage').style.backgroundImage = `url(${state.beforeImage})`;
189
+ document.getElementById('afterImage').style.backgroundImage = `url(${state.afterImage})`;
190
+
191
+ updateSlider();
192
+ updateTransform();
193
+ } else {
194
+ container.style.display = 'none';
195
+ placeholder.style.display = 'flex';
196
+ }
197
+ }
198
+
199
+ function updateSlider() {
200
+ const slider = document.getElementById('slider');
201
+ slider.style.left = `${state.sliderPosition}%`;
202
+
203
+ const compensated = getCompensatedSliderPosition();
204
+ document.getElementById('beforeImage').style.maskImage =
205
+ `linear-gradient(to right, black ${compensated}%, transparent ${compensated}%)`;
206
+ document.getElementById('beforeImage').style.webkitMaskImage =
207
+ `linear-gradient(to right, black ${compensated}%, transparent ${compensated}%)`;
208
+ }
209
+
210
+ function getCompensatedSliderPosition() {
211
+ const container = document.getElementById('compareContainer');
212
+ if (!container) return state.sliderPosition;
213
+
214
+ const containerWidth = container.clientWidth;
215
+ const zoomCompensation = ((state.zoom - 1) * (state.sliderPosition - 50)) / state.zoom;
216
+ const positionCompensation = (state.position.x / containerWidth) * 100 / state.zoom;
217
+ return state.sliderPosition - zoomCompensation - positionCompensation;
218
+ }
219
+
220
+ function updateTransform() {
221
+ const imageContainer = document.getElementById('imageContainer');
222
+ imageContainer.style.transform =
223
+ `translate3d(${state.position.x}px, ${state.position.y}px, 0) scale(${state.zoom})`;
224
+ }
225
+
226
+ document.addEventListener('DOMContentLoaded', () => {
227
+ const container = document.getElementById('compareContainer');
228
+
229
+ document.getElementById('beforeInput').addEventListener('change', e => handleImageUpload(e, 'before'));
230
+ document.getElementById('afterInput').addEventListener('change', e => handleImageUpload(e, 'after'));
231
+
232
+ container.addEventListener('mousedown', e => {
233
+ if (e.target.closest('.slider-handle')) {
234
+ state.isDragging = true;
235
+ } else {
236
+ state.isMoving = true;
237
+ state.lastPosition = {
238
+ x: e.clientX - state.position.x,
239
+ y: e.clientY - state.position.y
240
+ };
241
+ }
242
+ });
243
+
244
+ document.addEventListener('mouseup', () => {
245
+ state.isDragging = false;
246
+ state.isMoving = false;
247
+ });
248
+
249
+ document.addEventListener('mousemove', e => {
250
+ if (state.isDragging) {
251
+ const rect = container.getBoundingClientRect();
252
+ const x = e.clientX - rect.left;
253
+ state.sliderPosition = Math.min(Math.max((x / rect.width) * 100, 0), 100);
254
+ updateSlider();
255
+ } else if (state.isMoving) {
256
+ state.position.x = e.clientX - state.lastPosition.x;
257
+ state.position.y = e.clientY - state.lastPosition.y;
258
+ updateTransform();
259
+ updateSlider();
260
+ }
261
+ });
262
+
263
+ container.addEventListener('wheel', e => {
264
+ e.preventDefault();
265
+ state.zoom = Math.min(Math.max(state.zoom + (e.deltaY > 0 ? -0.1 : 0.1), 0.5), 5);
266
+ updateTransform();
267
+ updateSlider();
268
+ });
269
+ });
270
+ </script>
271
+ </body>
272
+ </html>
NeuroPort/HTML+APPS/LavaLamp_Black_v2.html ADDED
@@ -0,0 +1,380 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>RGB Lava Lamp Screensaver</title>
7
+ <style>
8
+ body {
9
+ margin: 0;
10
+ padding: 0;
11
+ overflow: hidden;
12
+ background-color: #000;
13
+ }
14
+ .wrap {
15
+ overflow: hidden;
16
+ position: relative;
17
+ height: 100vh;
18
+ background-color: #000;
19
+ }
20
+ canvas {
21
+ width: 100%;
22
+ height: 100%;
23
+ filter: blur(3px);
24
+ }
25
+ </style>
26
+ </head>
27
+ <body>
28
+ <div class="wrap">
29
+ <canvas id="bubble"></canvas>
30
+ </div>
31
+
32
+ <script>
33
+ ;(function() {
34
+ "use strict";
35
+
36
+ var lavaLamps = [];
37
+ var colorCycles = [];
38
+
39
+ var ge1doot = {
40
+ screen: {
41
+ elem: null,
42
+ callback: null,
43
+ ctx: null,
44
+ width: 0,
45
+ height: 0,
46
+ left: 0,
47
+ top: 0,
48
+ init: function (id, callback, initRes) {
49
+ this.elem = document.getElementById(id);
50
+ this.callback = callback || null;
51
+ if (this.elem.tagName == "CANVAS") this.ctx = this.elem.getContext("2d");
52
+ window.addEventListener('resize', function () {
53
+ this.resize();
54
+ }.bind(this), false);
55
+ this.elem.onselectstart = function () { return false; }
56
+ this.elem.ondrag = function () { return false; }
57
+ initRes && this.resize();
58
+ return this;
59
+ },
60
+ resize: function () {
61
+ var o = this.elem;
62
+ this.width = o.offsetWidth;
63
+ this.height = o.offsetHeight;
64
+ for (this.left = 0, this.top = 0; o != null; o = o.offsetParent) {
65
+ this.left += o.offsetLeft;
66
+ this.top += o.offsetTop;
67
+ }
68
+ if (this.ctx) {
69
+ this.elem.width = this.width;
70
+ this.elem.height = this.height;
71
+ }
72
+ this.callback && this.callback();
73
+ }
74
+ }
75
+ }
76
+
77
+ // Color utility functions
78
+ function hslToRgb(h, s, l) {
79
+ var r, g, b;
80
+ if (s == 0) {
81
+ r = g = b = l;
82
+ } else {
83
+ function hue2rgb(p, q, t) {
84
+ if (t < 0) t += 1;
85
+ if (t > 1) t -= 1;
86
+ if (t < 1/6) return p + (q - p) * 6 * t;
87
+ if (t < 1/2) return q;
88
+ if (t < 2/3) return p + (q - p) * (2/3 - t) * 6;
89
+ return p;
90
+ }
91
+ var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
92
+ var p = 2 * l - q;
93
+ r = hue2rgb(p, q, h + 1/3);
94
+ g = hue2rgb(p, q, h);
95
+ b = hue2rgb(p, q, h - 1/3);
96
+ }
97
+ return [Math.round(r * 255), Math.round(g * 255), Math.round(b * 255)];
98
+ }
99
+
100
+ function rgbToHex(r, g, b) {
101
+ return "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
102
+ }
103
+
104
+ // Color cycle class
105
+ var ColorCycle = function(h, s, l, speed) {
106
+ this.h = h;
107
+ this.s = s;
108
+ this.l = l;
109
+ this.speed = speed;
110
+ this.targetH = h;
111
+ this.currentH = h;
112
+ };
113
+
114
+ ColorCycle.prototype.update = function(dt) {
115
+ // Update target hue
116
+ this.targetH += this.speed * dt;
117
+ if (this.targetH > 1) this.targetH -= 1;
118
+ if (this.targetH < 0) this.targetH += 1;
119
+
120
+ // Smoothly interpolate current hue towards target (eases transitions)
121
+ var diff = this.targetH - this.currentH;
122
+ // Handle wrapping around 1
123
+ if (diff > 0.5) diff -= 1;
124
+ if (diff < -0.5) diff += 1;
125
+
126
+ // Smooth interpolation factor
127
+ this.currentH += diff * Math.min(1, dt * 3);
128
+ if (this.currentH > 1) this.currentH -= 1;
129
+ if (this.currentH < 0) this.currentH += 1;
130
+ };
131
+
132
+ ColorCycle.prototype.getColor = function() {
133
+ var rgb = hslToRgb(this.currentH, this.s, this.l);
134
+ return rgbToHex(rgb[0], rgb[1], rgb[2]);
135
+ };
136
+
137
+ // Point constructor
138
+ var Point = function(x, y) {
139
+ this.x = x;
140
+ this.y = y;
141
+ this.magnitude = x * x + y * y;
142
+ this.computed = 0;
143
+ this.force = 0;
144
+ };
145
+
146
+ Point.prototype.add = function(p) {
147
+ return new Point(this.x + p.x, this.y + p.y);
148
+ };
149
+
150
+ // Ball constructor with scaled speed and size
151
+ var Ball = function(parent) {
152
+ var min = .1;
153
+ var max = 1.5;
154
+ var scale = parent.wh / 1080; // Scale relative to Full HD
155
+ this.vel = new Point(
156
+ (Math.random() > 0.5 ? 1 : -1) * (0.05 + Math.random() * 0.1) * scale,
157
+ (Math.random() > 0.5 ? 1 : -1) * (0.05 + Math.random() * 0.1) * scale
158
+ );
159
+ this.pos = new Point(
160
+ parent.width * 0.2 + Math.random() * parent.width * 0.6,
161
+ parent.height * 0.2 + Math.random() * parent.height * 0.6
162
+ );
163
+ this.size = (parent.wh / 15) * scale + (Math.random() * (max - min) + min) * (parent.wh / 15) * scale;
164
+ this.width = parent.width;
165
+ this.height = parent.height;
166
+ };
167
+
168
+ // Move balls
169
+ Ball.prototype.move = function() {
170
+ if (this.pos.x >= this.width - this.size) {
171
+ if (this.vel.x > 0) this.vel.x = -this.vel.x;
172
+ this.pos.x = this.width - this.size;
173
+ } else if (this.pos.x <= this.size) {
174
+ if (this.vel.x < 0) this.vel.x = -this.vel.x;
175
+ this.pos.x = this.size;
176
+ }
177
+
178
+ if (this.pos.y >= this.height - this.size) {
179
+ if (this.vel.y > 0) this.vel.y = -this.vel.y;
180
+ this.pos.y = this.height - this.size;
181
+ } else if (this.pos.y <= this.size) {
182
+ if (this.vel.y < 0) this.vel.y = -this.vel.y;
183
+ this.pos.y = this.size;
184
+ }
185
+
186
+ this.pos = this.pos.add(this.vel);
187
+ };
188
+
189
+ // LavaLamp constructor with adaptive grid step
190
+ var LavaLamp = function(width, height, numBalls, colorTop, colorBottom) {
191
+ this.step = Math.floor(Math.min(width, height) / 100); // Adaptive grid step
192
+ this.width = width;
193
+ this.height = height;
194
+ this.wh = Math.min(width, height);
195
+ this.sx = Math.floor(this.width / this.step);
196
+ this.sy = Math.floor(this.height / this.step);
197
+ this.paint = false;
198
+ this.colorTop = colorTop;
199
+ this.colorBottom = colorBottom;
200
+ this.plx = [0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0];
201
+ this.ply = [0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1];
202
+ this.mscases = [0, 3, 0, 3, 1, 3, 0, 3, 2, 2, 0, 2, 1, 1, 0];
203
+ this.ix = [1, 0, -1, 0, 0, 1, 0, -1, -1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1];
204
+ this.grid = [];
205
+ this.balls = [];
206
+ this.iter = 0;
207
+ this.sign = 1;
208
+
209
+ for (var i = 0; i < (this.sx + 2) * (this.sy + 2); i++) {
210
+ this.grid[i] = new Point(
211
+ (i % (this.sx + 2)) * this.step, (Math.floor(i / (this.sx + 2))) * this.step
212
+ )
213
+ }
214
+
215
+ for (var k = 0; k < numBalls; k++) {
216
+ this.balls[k] = new Ball(this);
217
+ }
218
+ };
219
+
220
+ // Compute force
221
+ LavaLamp.prototype.computeForce = function(x, y, idx) {
222
+ var force;
223
+ var id = idx || x + y * (this.sx + 2);
224
+
225
+ if (x === 0 || y === 0 || x === this.sx || y === this.sy) {
226
+ force = 0.6 * this.sign;
227
+ } else {
228
+ force = 0;
229
+ var cell = this.grid[id];
230
+ var i = 0;
231
+ var ball;
232
+ while (ball = this.balls[i++]) {
233
+ force += ball.size * ball.size / (-2 * cell.x * ball.pos.x - 2 * cell.y * ball.pos.y + ball.pos.magnitude + cell.magnitude);
234
+ }
235
+ force *= this.sign
236
+ }
237
+ this.grid[id].force = force;
238
+ return force;
239
+ };
240
+
241
+ // Marching squares
242
+ LavaLamp.prototype.marchingSquares = function(next) {
243
+ var x = next[0];
244
+ var y = next[1];
245
+ var pdir = next[2];
246
+ var id = x + y * (this.sx + 2);
247
+ if (this.grid[id].computed === this.iter) {
248
+ return false;
249
+ }
250
+ var dir, mscase = 0;
251
+
252
+ for (var i = 0; i < 4; i++) {
253
+ var idn = (x + this.ix[i + 12]) + (y + this.ix[i + 16]) * (this.sx + 2);
254
+ var force = this.grid[idn].force;
255
+ if ((force > 0 && this.sign < 0) || (force < 0 && this.sign > 0) || !force) {
256
+ force = this.computeForce(
257
+ x + this.ix[i + 12],
258
+ y + this.ix[i + 16],
259
+ idn
260
+ );
261
+ }
262
+ if (Math.abs(force) > 1) mscase += Math.pow(2, i);
263
+ }
264
+ if (mscase === 15) {
265
+ return [x, y - 1, false];
266
+ } else {
267
+ if (mscase === 5) dir = (pdir === 2) ? 3 : 1;
268
+ else if (mscase === 10) dir = (pdir === 3) ? 0 : 2;
269
+ else {
270
+ dir = this.mscases[mscase];
271
+ this.grid[id].computed = this.iter;
272
+ }
273
+ var ix = this.step / (
274
+ Math.abs(Math.abs(this.grid[(x + this.plx[4 * dir + 2]) + (y + this.ply[4 * dir + 2]) * (this.sx + 2)].force) - 1) /
275
+ Math.abs(Math.abs(this.grid[(x + this.plx[4 * dir + 3]) + (y + this.ply[4 * dir + 3]) * (this.sx + 2)].force) - 1) + 1
276
+ );
277
+ ctx.lineTo(
278
+ this.grid[(x + this.plx[4 * dir]) + (y + this.ply[4 * dir]) * (this.sx + 2)].x + this.ix[dir] * ix,
279
+ this.grid[(x + this.plx[4 * dir + 1]) + (y + this.ply[4 * dir + 1]) * (this.sx + 2)].y + this.ix[dir + 4] * ix
280
+ );
281
+ this.paint = true;
282
+ return [
283
+ x + this.ix[dir + 4],
284
+ y + this.ix[dir + 8],
285
+ dir
286
+ ];
287
+ }
288
+ };
289
+
290
+ // Render metaballs with vertical gradient and enhanced effects
291
+ LavaLamp.prototype.renderMetaballs = function() {
292
+ var i = 0, ball;
293
+ while (ball = this.balls[i++]) ball.move();
294
+ this.iter++;
295
+ this.sign = -this.sign;
296
+ this.paint = false;
297
+
298
+ // Create vertical gradient for the metaball
299
+ var gradient = ctx.createLinearGradient(0, 0, 0, this.height);
300
+ gradient.addColorStop(0, this.colorTop);
301
+ gradient.addColorStop(1, this.colorBottom);
302
+
303
+ // Set fill style
304
+ ctx.fillStyle = gradient;
305
+
306
+ // Add shadow effect for inner glow (reduced blur for smoother transitions)
307
+ ctx.shadowBlur = 10;
308
+ ctx.shadowColor = this.colorBottom;
309
+
310
+ // Set blend mode for more vibrant colors
311
+ ctx.globalCompositeOperation = "lighter";
312
+
313
+ // Process each metaball
314
+ i = 0;
315
+ while (ball = this.balls[i++]) {
316
+ ctx.beginPath();
317
+ var next = [
318
+ Math.round(ball.pos.x / this.step),
319
+ Math.round(ball.pos.y / this.step), false
320
+ ];
321
+ do {
322
+ next = this.marchingSquares(next);
323
+ } while (next);
324
+ if (this.paint) {
325
+ ctx.fill();
326
+ ctx.closePath();
327
+ this.paint = false;
328
+ }
329
+ }
330
+
331
+ // Reset to standard blend mode
332
+ ctx.globalCompositeOperation = "source-over";
333
+ ctx.shadowBlur = 0;
334
+ };
335
+
336
+ // Main loop with refined motion blur
337
+ var lastTime = 0;
338
+ var run = function(time) {
339
+ var dt = (time - lastTime) / 1000;
340
+ // Limit dt to prevent large jumps if tab was inactive
341
+ dt = Math.min(dt, 0.1);
342
+ lastTime = time;
343
+
344
+ requestAnimationFrame(run);
345
+
346
+ // Apply more subtle motion blur effect for smoother animation
347
+ ctx.fillStyle = 'rgba(0, 0, 0, 0.9)';
348
+ ctx.fillRect(0, 0, screen.width, screen.height);
349
+
350
+ for (var i = 0; i < colorCycles.length; i++) {
351
+ colorCycles[i].update(dt);
352
+ }
353
+
354
+ for (var i = 0; i < lavaLamps.length; i++) {
355
+ var lamp = lavaLamps[i];
356
+ lamp.colorTop = colorCycles[0].getColor();
357
+ lamp.colorBottom = colorCycles[1].getColor();
358
+ lamp.renderMetaballs();
359
+ }
360
+ };
361
+
362
+ // Canvas initialization
363
+ var screen = ge1doot.screen.init("bubble", null, true),
364
+ ctx = screen.ctx;
365
+ screen.resize();
366
+
367
+ // Create color cycles with smoother transition speeds
368
+ colorCycles.push(new ColorCycle(0.6, 0.9, 0.5, 0.005)); // Cool colors (blue/purple/cyan) - slower transition
369
+ colorCycles.push(new ColorCycle(0.0, 0.9, 0.5, 0.008)); // Warm colors (red/orange/yellow) - slower transition
370
+
371
+ // Create LavaLamp with dynamic number of balls for 4K support
372
+ var numBalls = Math.min(20, Math.max(10, Math.floor(screen.width * screen.height / 1000000)));
373
+ lavaLamps.push(new LavaLamp(screen.width, screen.height, numBalls, "#0000FF", "#FF0000"));
374
+
375
+ // Start animation
376
+ requestAnimationFrame(run);
377
+ })();
378
+ </script>
379
+ </body>
380
+ </html>
NeuroPort/HTML+APPS/LavaLamp_RGB_v2.html ADDED
@@ -0,0 +1,363 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Improved RGB Lava Lamp Screensaver</title>
7
+ <style>
8
+ body {
9
+ margin: 0;
10
+ padding: 0;
11
+ overflow: hidden;
12
+ background-color: #000;
13
+ }
14
+ .wrap {
15
+ overflow: hidden;
16
+ position: relative;
17
+ height: 100vh;
18
+ background-color: #000;
19
+ }
20
+ canvas {
21
+ width: 100%;
22
+ height: 100%;
23
+ filter: blur(3px);
24
+ }
25
+ </style>
26
+ </head>
27
+ <body>
28
+ <div class="wrap">
29
+ <canvas id="bubble"></canvas>
30
+ </div>
31
+
32
+ <script>
33
+ ;(function() {
34
+ "use strict";
35
+
36
+ var lavaLamps = [];
37
+ var colorCycles = [];
38
+
39
+ var ge1doot = {
40
+ screen: {
41
+ elem: null,
42
+ callback: null,
43
+ ctx: null,
44
+ width: 0,
45
+ height: 0,
46
+ left: 0,
47
+ top: 0,
48
+ init: function (id, callback, initRes) {
49
+ this.elem = document.getElementById(id);
50
+ this.callback = callback || null;
51
+ if (this.elem.tagName == "CANVAS") this.ctx = this.elem.getContext("2d");
52
+ window.addEventListener('resize', function () {
53
+ this.resize();
54
+ }.bind(this), false);
55
+ this.elem.onselectstart = function () { return false; }
56
+ this.elem.ondrag = function () { return false; }
57
+ initRes && this.resize();
58
+ return this;
59
+ },
60
+ resize: function () {
61
+ var o = this.elem;
62
+ this.width = o.offsetWidth;
63
+ this.height = o.offsetHeight;
64
+ for (this.left = 0, this.top = 0; o != null; o = o.offsetParent) {
65
+ this.left += o.offsetLeft;
66
+ this.top += o.offsetTop;
67
+ }
68
+ if (this.ctx) {
69
+ this.elem.width = this.width;
70
+ this.elem.height = this.height;
71
+ }
72
+ this.callback && this.callback();
73
+ }
74
+ }
75
+ }
76
+
77
+ // Color utility functions
78
+ function hslToRgb(h, s, l) {
79
+ var r, g, b;
80
+ if (s == 0) {
81
+ r = g = b = l;
82
+ } else {
83
+ function hue2rgb(p, q, t) {
84
+ if (t < 0) t += 1;
85
+ if (t > 1) t -= 1;
86
+ if (t < 1/6) return p + (q - p) * 6 * t;
87
+ if (t < 1/2) return q;
88
+ if (t < 2/3) return p + (q - p) * (2/3 - t) * 6;
89
+ return p;
90
+ }
91
+ var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
92
+ var p = 2 * l - q;
93
+ r = hue2rgb(p, q, h + 1/3);
94
+ g = hue2rgb(p, q, h);
95
+ b = hue2rgb(p, q, h - 1/3);
96
+ }
97
+ return [Math.round(r * 255), Math.round(g * 255), Math.round(b * 255)];
98
+ }
99
+
100
+ function rgbToHex(r, g, b) {
101
+ return "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
102
+ }
103
+
104
+ // Color cycle class
105
+ var ColorCycle = function(h, s, l, speed) {
106
+ this.h = h;
107
+ this.s = s;
108
+ this.l = l;
109
+ this.speed = speed;
110
+ };
111
+
112
+ ColorCycle.prototype.update = function(dt) {
113
+ this.h += this.speed * dt;
114
+ if (this.h > 1) this.h -= 1;
115
+ if (this.h < 0) this.h += 1;
116
+ };
117
+
118
+ ColorCycle.prototype.getColor = function() {
119
+ var rgb = hslToRgb(this.h, this.s, this.l);
120
+ return rgbToHex(rgb[0], rgb[1], rgb[2]);
121
+ };
122
+
123
+ // Point constructor
124
+ var Point = function(x, y) {
125
+ this.x = x;
126
+ this.y = y;
127
+ this.magnitude = x * x + y * y;
128
+ this.computed = 0;
129
+ this.force = 0;
130
+ };
131
+
132
+ Point.prototype.add = function(p) {
133
+ return new Point(this.x + p.x, this.y + p.y);
134
+ };
135
+
136
+ // Ball constructor with scaled speed and size
137
+ var Ball = function(parent) {
138
+ var min = .1;
139
+ var max = 1.5;
140
+ var scale = parent.wh / 1080; // Scale relative to Full HD
141
+ this.vel = new Point(
142
+ (Math.random() > 0.5 ? 1 : -1) * (0.05 + Math.random() * 0.1) * scale,
143
+ (Math.random() > 0.5 ? 1 : -1) * (0.05 + Math.random() * 0.1) * scale
144
+ );
145
+ this.pos = new Point(
146
+ parent.width * 0.2 + Math.random() * parent.width * 0.6,
147
+ parent.height * 0.2 + Math.random() * parent.height * 0.6
148
+ );
149
+ this.size = (parent.wh / 15) * scale + (Math.random() * (max - min) + min) * (parent.wh / 15) * scale;
150
+ this.width = parent.width;
151
+ this.height = parent.height;
152
+ };
153
+
154
+ // Move balls
155
+ Ball.prototype.move = function() {
156
+ if (this.pos.x >= this.width - this.size) {
157
+ if (this.vel.x > 0) this.vel.x = -this.vel.x;
158
+ this.pos.x = this.width - this.size;
159
+ } else if (this.pos.x <= this.size) {
160
+ if (this.vel.x < 0) this.vel.x = -this.vel.x;
161
+ this.pos.x = this.size;
162
+ }
163
+
164
+ if (this.pos.y >= this.height - this.size) {
165
+ if (this.vel.y > 0) this.vel.y = -this.vel.y;
166
+ this.pos.y = this.height - this.size;
167
+ } else if (this.pos.y <= this.size) {
168
+ if (this.vel.y < 0) this.vel.y = -this.vel.y;
169
+ this.pos.y = this.size;
170
+ }
171
+
172
+ this.pos = this.pos.add(this.vel);
173
+ };
174
+
175
+ // LavaLamp constructor with adaptive grid step
176
+ var LavaLamp = function(width, height, numBalls, colorTop, colorBottom) {
177
+ this.step = Math.floor(Math.min(width, height) / 100); // Adaptive grid step
178
+ this.width = width;
179
+ this.height = height;
180
+ this.wh = Math.min(width, height);
181
+ this.sx = Math.floor(this.width / this.step);
182
+ this.sy = Math.floor(this.height / this.step);
183
+ this.paint = false;
184
+ this.colorTop = colorTop;
185
+ this.colorBottom = colorBottom;
186
+ this.plx = [0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0];
187
+ this.ply = [0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1];
188
+ this.mscases = [0, 3, 0, 3, 1, 3, 0, 3, 2, 2, 0, 2, 1, 1, 0];
189
+ this.ix = [1, 0, -1, 0, 0, 1, 0, -1, -1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1];
190
+ this.grid = [];
191
+ this.balls = [];
192
+ this.iter = 0;
193
+ this.sign = 1;
194
+
195
+ for (var i = 0; i < (this.sx + 2) * (this.sy + 2); i++) {
196
+ this.grid[i] = new Point(
197
+ (i % (this.sx + 2)) * this.step, (Math.floor(i / (this.sx + 2))) * this.step
198
+ )
199
+ }
200
+
201
+ for (var k = 0; k < numBalls; k++) {
202
+ this.balls[k] = new Ball(this);
203
+ }
204
+ };
205
+
206
+ // Compute force
207
+ LavaLamp.prototype.computeForce = function(x, y, idx) {
208
+ var force;
209
+ var id = idx || x + y * (this.sx + 2);
210
+
211
+ if (x === 0 || y === 0 || x === this.sx || y === this.sy) {
212
+ force = 0.6 * this.sign;
213
+ } else {
214
+ force = 0;
215
+ var cell = this.grid[id];
216
+ var i = 0;
217
+ var ball;
218
+ while (ball = this.balls[i++]) {
219
+ force += ball.size * ball.size / (-2 * cell.x * ball.pos.x - 2 * cell.y * ball.pos.y + ball.pos.magnitude + cell.magnitude);
220
+ }
221
+ force *= this.sign
222
+ }
223
+ this.grid[id].force = force;
224
+ return force;
225
+ };
226
+
227
+ // Marching squares
228
+ LavaLamp.prototype.marchingSquares = function(next) {
229
+ var x = next[0];
230
+ var y = next[1];
231
+ var pdir = next[2];
232
+ var id = x + y * (this.sx + 2);
233
+ if (this.grid[id].computed === this.iter) {
234
+ return false;
235
+ }
236
+ var dir, mscase = 0;
237
+
238
+ for (var i = 0; i < 4; i++) {
239
+ var idn = (x + this.ix[i + 12]) + (y + this.ix[i + 16]) * (this.sx + 2);
240
+ var force = this.grid[idn].force;
241
+ if ((force > 0 && this.sign < 0) || (force < 0 && this.sign > 0) || !force) {
242
+ force = this.computeForce(
243
+ x + this.ix[i + 12],
244
+ y + this.ix[i + 16],
245
+ idn
246
+ );
247
+ }
248
+ if (Math.abs(force) > 1) mscase += Math.pow(2, i);
249
+ }
250
+ if (mscase === 15) {
251
+ return [x, y - 1, false];
252
+ } else {
253
+ if (mscase === 5) dir = (pdir === 2) ? 3 : 1;
254
+ else if (mscase === 10) dir = (pdir === 3) ? 0 : 2;
255
+ else {
256
+ dir = this.mscases[mscase];
257
+ this.grid[id].computed = this.iter;
258
+ }
259
+ var ix = this.step / (
260
+ Math.abs(Math.abs(this.grid[(x + this.plx[4 * dir + 2]) + (y + this.ply[4 * dir + 2]) * (this.sx + 2)].force) - 1) /
261
+ Math.abs(Math.abs(this.grid[(x + this.plx[4 * dir + 3]) + (y + this.ply[4 * dir + 3]) * (this.sx + 2)].force) - 1) + 1
262
+ );
263
+ ctx.lineTo(
264
+ this.grid[(x + this.plx[4 * dir]) + (y + this.ply[4 * dir]) * (this.sx + 2)].x + this.ix[dir] * ix,
265
+ this.grid[(x + this.plx[4 * dir + 1]) + (y + this.ply[4 * dir + 1]) * (this.sx + 2)].y + this.ix[dir + 4] * ix
266
+ );
267
+ this.paint = true;
268
+ return [
269
+ x + this.ix[dir + 4],
270
+ y + this.ix[dir + 8],
271
+ dir
272
+ ];
273
+ }
274
+ };
275
+
276
+ // Render metaballs with vertical gradient and enhanced effects
277
+ LavaLamp.prototype.renderMetaballs = function() {
278
+ var i = 0, ball;
279
+ while (ball = this.balls[i++]) ball.move();
280
+ this.iter++;
281
+ this.sign = -this.sign;
282
+ this.paint = false;
283
+
284
+ // Создаем вертикальный градиент для всего метаболла
285
+ var gradient = ctx.createLinearGradient(0, 0, 0, this.height);
286
+ gradient.addColorStop(0, this.colorTop);
287
+ gradient.addColorStop(1, this.colorBottom);
288
+
289
+ // Устанавливаем стиль заливки
290
+ ctx.fillStyle = gradient;
291
+
292
+ // Добавляем эффект тени для внутреннего свечения
293
+ ctx.shadowBlur = 15;
294
+ ctx.shadowColor = this.colorBottom;
295
+
296
+ // Устанавливаем режим наложения для более ярких цвето��
297
+ ctx.globalCompositeOperation = "lighter";
298
+
299
+ // Обрабатываем каждый метаболл
300
+ i = 0;
301
+ while (ball = this.balls[i++]) {
302
+ ctx.beginPath();
303
+ var next = [
304
+ Math.round(ball.pos.x / this.step),
305
+ Math.round(ball.pos.y / this.step), false
306
+ ];
307
+ do {
308
+ next = this.marchingSquares(next);
309
+ } while (next);
310
+ if (this.paint) {
311
+ ctx.fill();
312
+ ctx.closePath();
313
+ this.paint = false;
314
+ }
315
+ }
316
+
317
+ // Возвращаем стандартный режим наложения
318
+ ctx.globalCompositeOperation = "source-over";
319
+ };
320
+
321
+ // Main loop with motion blur
322
+ var lastTime = 0;
323
+ var run = function(time) {
324
+ var dt = (time - lastTime) / 1000;
325
+ lastTime = time;
326
+
327
+ requestAnimationFrame(run);
328
+
329
+ // Применяем эффект motion blur для плавности движения
330
+ ctx.fillStyle = 'rgba(0, 0, 0, 0.8)';
331
+ ctx.fillRect(0, 0, screen.width, screen.height);
332
+
333
+ for (var i = 0; i < colorCycles.length; i++) {
334
+ colorCycles[i].update(dt);
335
+ }
336
+
337
+ for (var i = 0; i < lavaLamps.length; i++) {
338
+ var lamp = lavaLamps[i];
339
+ lamp.colorTop = colorCycles[0].getColor();
340
+ lamp.colorBottom = colorCycles[1].getColor();
341
+ lamp.renderMetaballs();
342
+ }
343
+ };
344
+
345
+ // Canvas initialization
346
+ var screen = ge1doot.screen.init("bubble", null, true),
347
+ ctx = screen.ctx;
348
+ screen.resize();
349
+
350
+ // Create color cycles with good values for RGB transitions
351
+ colorCycles.push(new ColorCycle(0.6, 0.9, 0.5, 0.01)); // Cool colors (blue/purple/cyan)
352
+ colorCycles.push(new ColorCycle(0.0, 0.9, 0.5, 0.02)); // Warm colors (red/orange/yellow)
353
+
354
+ // Create LavaLamp with dynamic number of balls for 4K support
355
+ var numBalls = Math.min(15, Math.max(8, Math.floor(screen.width * screen.height / 1000000)));
356
+ lavaLamps.push(new LavaLamp(screen.width, screen.height, numBalls, "#0000FF", "#FF0000"));
357
+
358
+ // Start animation
359
+ requestAnimationFrame(run);
360
+ })();
361
+ </script>
362
+ </body>
363
+ </html>
NeuroPort/HTML+APPS/Ping Pong/Ping Pong.html ADDED
@@ -0,0 +1,434 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Pong Game</title>
5
+ <style>
6
+ body {
7
+ display: flex;
8
+ flex-direction: column;
9
+ align-items: center;
10
+ background: #1a1a1a;
11
+ margin: 0;
12
+ min-height: 100vh;
13
+ font-family: Arial, sans-serif;
14
+ }
15
+ canvas {
16
+ border: 2px solid #fff;
17
+ margin: 20px 0;
18
+ }
19
+ .menu {
20
+ margin: 20px;
21
+ text-align: center;
22
+ }
23
+ button {
24
+ padding: 10px 20px;
25
+ margin: 5px;
26
+ cursor: pointer;
27
+ background: #4CAF50;
28
+ border: none;
29
+ color: white;
30
+ border-radius: 4px;
31
+ font-size: 16px;
32
+ }
33
+ .game-over {
34
+ display: none;
35
+ position: fixed;
36
+ top: 50%;
37
+ left: 50%;
38
+ transform: translate(-50%, -50%);
39
+ font-size: 48px;
40
+ font-weight: bold;
41
+ color: white;
42
+ text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
43
+ animation: zoom 1s infinite;
44
+ z-index: 1000;
45
+ text-align: center;
46
+ }
47
+ @keyframes zoom {
48
+ 0% { transform: translate(-50%, -50%) scale(1); }
49
+ 50% { transform: translate(-50%, -50%) scale(1.2); }
50
+ 100% { transform: translate(-50%, -50%) scale(1); }
51
+ }
52
+ #fullscreenBtn {
53
+ position: fixed;
54
+ bottom: 20px;
55
+ left: 50%;
56
+ transform: translateX(-50%);
57
+ z-index: 1000;
58
+ }
59
+ .score {
60
+ position: fixed;
61
+ top: 20px;
62
+ font-size: 40px;
63
+ color: white;
64
+ transition: all 0.3s ease;
65
+ }
66
+ .score.changed {
67
+ transform: scale(1.5);
68
+ color: #4CAF50;
69
+ }
70
+ #leftPlayerName {
71
+ left: 20px;
72
+ }
73
+ #rightPlayerName {
74
+ right: 20px;
75
+ }
76
+ #playerNames {
77
+ position: fixed;
78
+ top: 50%;
79
+ left: 50%;
80
+ transform: translate(-50%, -50%);
81
+ background: rgba(0,0,0,0.8);
82
+ padding: 20px;
83
+ border-radius: 10px;
84
+ text-align: center;
85
+ color: white;
86
+ z-index: 1001;
87
+ }
88
+ #playerNames input {
89
+ margin: 10px;
90
+ padding: 8px;
91
+ font-size: 16px;
92
+ width: 200px;
93
+ }
94
+ .player-name {
95
+ position: fixed;
96
+ top: 80px;
97
+ font-size: 24px;
98
+ color: white;
99
+ text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
100
+ }
101
+ .goal-effect {
102
+ position: fixed;
103
+ top: 0;
104
+ left: 0;
105
+ width: 100%;
106
+ height: 100%;
107
+ background: rgba(255,255,255,0.3);
108
+ animation: blink 0.5s linear 2;
109
+ pointer-events: none;
110
+ display: none;
111
+ }
112
+ @keyframes blink {
113
+ 0%, 100% { opacity: 0; }
114
+ 50% { opacity: 1; }
115
+ }
116
+ </style>
117
+ </head>
118
+ <body>
119
+ <div id="playerNames">
120
+ <h2>Введите имена игроков</h2>
121
+ <input type="text" id="leftPlayer" placeholder="Левый игрок">
122
+ <input type="text" id="rightPlayer" placeholder="Правый игрок"><br>
123
+ <button onclick="startGame()">Начать игру</button>
124
+ </div>
125
+
126
+ <div class="goal-effect" id="goalEffect"></div>
127
+
128
+ <div class="player-name" id="leftPlayerName"></div>
129
+ <div class="player-name" id="rightPlayerName"></div>
130
+ <div class="score" id="leftScore" style="left: 20px;">0</div>
131
+ <div class="score" id="rightScore" style="right: 20px;">0</div>
132
+
133
+ <button id="fullscreenBtn" onclick="toggleFullscreen()">⛶</button>
134
+ <canvas id="gameCanvas" width="800" height="500"></canvas>
135
+ <div id="gameOver" class="game-over"></div>
136
+
137
+ <!-- Звуковые файлы -->
138
+ <audio id="paddleSound" src="paddle_hit.wav"></audio>
139
+ <audio id="obstacleSound" src="obstacle_hit.wav"></audio>
140
+ <audio id="winSound" src="win_sound.wav"></audio>
141
+ <audio id="goalSound" src="goal.wav"></audio>
142
+
143
+ <script>
144
+ const canvas = document.getElementById('gameCanvas');
145
+ const ctx = canvas.getContext('2d');
146
+ const gameOverElement = document.getElementById('gameOver');
147
+ const playerNamesDiv = document.getElementById('playerNames');
148
+ const leftPlayerNameElement = document.getElementById('leftPlayerName');
149
+ const rightPlayerNameElement = document.getElementById('rightPlayerName');
150
+ const leftScoreElement = document.getElementById('leftScore');
151
+ const rightScoreElement = document.getElementById('rightScore');
152
+
153
+ // Аудио элементы
154
+ const paddleSound = document.getElementById('paddleSound');
155
+ const obstacleSound = document.getElementById('obstacleSound');
156
+ const winSound = document.getElementById('winSound');
157
+ const goalSound = document.getElementById('goalSound');
158
+
159
+ // Игровые переменные
160
+ let gameMode = '';
161
+ let isPlaying = false;
162
+ let obstacles = [];
163
+ const obstacleTypes = ['paddle', 'ball', 'random'];
164
+ let leftPlayerName = 'Левый игрок';
165
+ let rightPlayerName = 'Правый игрок';
166
+
167
+ // Таймеры для препятствий
168
+ let lastObstacleTime = 0;
169
+ const OBSTACLE_INTERVAL = 5000;
170
+ const OBSTACLE_LIFETIME = 30000;
171
+
172
+ // Размеры объектов
173
+ let paddleHeight = 80;
174
+ const paddleWidth = 10;
175
+ const ballSize = 8;
176
+
177
+ // Позиции и скорости
178
+ let leftPaddleY = canvas.height/2 - paddleHeight/2;
179
+ let rightPaddleY = canvas.height/2 - paddleHeight/2;
180
+ let ballX = canvas.width/2;
181
+ let ballY = canvas.height/2;
182
+ let ballSpeedX = 5;
183
+ let ballSpeedY = 3;
184
+ let scoreLeft = 0;
185
+ let scoreRight = 0;
186
+
187
+ // Состояния клавиш
188
+ const keys = {
189
+ w: false,
190
+ s: false,
191
+ ArrowUp: false,
192
+ ArrowDown: false
193
+ };
194
+
195
+ function showGoalEffect() {
196
+ const effect = document.getElementById('goalEffect');
197
+ effect.style.display = 'block';
198
+ setTimeout(() => {
199
+ effect.style.display = 'none';
200
+ }, 1000);
201
+ }
202
+
203
+ function startGame() {
204
+ leftPlayerName = document.getElementById('leftPlayer').value || 'Левый игрок';
205
+ rightPlayerName = document.getElementById('rightPlayer').value || 'Правый игрок';
206
+ gameMode = 'hard';
207
+ playerNamesDiv.style.display = 'none';
208
+ initGame();
209
+ }
210
+
211
+ function initGame() {
212
+ isPlaying = true;
213
+ obstacles = [];
214
+ scoreLeft = 0;
215
+ scoreRight = 0;
216
+ lastObstacleTime = 0;
217
+ paddleHeight = 80;
218
+
219
+ leftPlayerNameElement.textContent = leftPlayerName;
220
+ rightPlayerNameElement.textContent = rightPlayerName;
221
+ leftScoreElement.textContent = '0';
222
+ rightScoreElement.textContent = '0';
223
+
224
+ resetBall();
225
+ gameLoop();
226
+ }
227
+
228
+ function resetBall() {
229
+ ballX = canvas.width/2;
230
+ ballY = canvas.height/2;
231
+ ballSpeedX = Math.random() > 0.5 ? 5 : -5;
232
+ ballSpeedY = 3;
233
+ }
234
+
235
+ function createObstacle() {
236
+ if (gameMode === 'hard' && Date.now() - lastObstacleTime > OBSTACLE_INTERVAL) {
237
+ const type = obstacleTypes[Math.floor(Math.random() * obstacleTypes.length)];
238
+ obstacles.push({
239
+ type: type,
240
+ x: Math.random() * (canvas.width - 40),
241
+ y: Math.random() * (canvas.height - 40),
242
+ width: 40,
243
+ height: 40,
244
+ createdAt: Date.now(),
245
+ color: type === 'paddle' ? (Math.random() > 0.5 ? 'red' : 'green') :
246
+ type === 'ball' ? ['red', 'blue', 'green'][Math.floor(Math.random()*3)] : 'yellow',
247
+ rotation: 0
248
+ });
249
+ lastObstacleTime = Date.now();
250
+ }
251
+ }
252
+
253
+ function handleObstacles() {
254
+ const now = Date.now();
255
+ obstacles = obstacles.filter(obs => now - obs.createdAt < OBSTACLE_LIFETIME);
256
+
257
+ obstacles.forEach((obs, index) => {
258
+ if (obs.type === 'random') obs.rotation += 0.1;
259
+
260
+ if (ballX + ballSize > obs.x &&
261
+ ballX < obs.x + obs.width &&
262
+ ballY + ballSize > obs.y &&
263
+ ballY < obs.y + obs.height) {
264
+
265
+ obstacleSound.currentTime = 0;
266
+ obstacleSound.play();
267
+
268
+ switch(obs.type) {
269
+ case 'paddle':
270
+ paddleHeight = obs.color === 'red' ? 60 : 100;
271
+ break;
272
+ case 'ball':
273
+ if(obs.color === 'red') {
274
+ ballSpeedX *= 1.5;
275
+ ballSpeedY *= 1.5;
276
+ } else if(obs.color === 'blue') {
277
+ ballSpeedX *= 0.7;
278
+ ballSpeedY *= 0.7;
279
+ } else {
280
+ ballSpeedX *= -1;
281
+ }
282
+ break;
283
+ case 'random':
284
+ ballSpeedX = (Math.random() - 0.5) * 10;
285
+ ballSpeedY = (Math.random() - 0.5) * 10;
286
+ break;
287
+ }
288
+ obstacles.splice(index, 1);
289
+ }
290
+ });
291
+ }
292
+
293
+ function drawObstacle(obs) {
294
+ ctx.save();
295
+ ctx.translate(obs.x + obs.width/2, obs.y + obs.height/2);
296
+ ctx.rotate(obs.rotation);
297
+
298
+ switch(obs.type) {
299
+ case 'paddle':
300
+ ctx.fillStyle = obs.color;
301
+ ctx.fillRect(-obs.width/2, -obs.height/2, obs.width, obs.height);
302
+ break;
303
+ case 'ball':
304
+ ctx.beginPath();
305
+ ctx.arc(0, 0, obs.width/2, 0, Math.PI*2);
306
+ ctx.fillStyle = obs.color;
307
+ ctx.fill();
308
+ break;
309
+ case 'random':
310
+ ctx.beginPath();
311
+ for(let i = 0; i < 5; i++) {
312
+ const angle = i * Math.PI*2/5;
313
+ const x = Math.cos(angle) * obs.width/2;
314
+ const y = Math.sin(angle) * obs.height/2;
315
+ if(i === 0) ctx.moveTo(x, y);
316
+ else ctx.lineTo(x, y);
317
+ }
318
+ ctx.closePath();
319
+ ctx.fillStyle = obs.color;
320
+ ctx.fill();
321
+ break;
322
+ }
323
+ ctx.restore();
324
+ }
325
+
326
+ function animateScore(isLeft) {
327
+ const element = isLeft ? leftScoreElement : rightScoreElement;
328
+ element.classList.add('changed');
329
+ setTimeout(() => element.classList.remove('changed'), 300);
330
+ }
331
+
332
+ function gameLoop() {
333
+ if (!isPlaying) return;
334
+
335
+ // Движение ракеток
336
+ if (keys.w && leftPaddleY > 0) leftPaddleY -= 5;
337
+ if (keys.s && leftPaddleY < canvas.height - paddleHeight) leftPaddleY += 5;
338
+ if (keys.ArrowUp && rightPaddleY > 0) rightPaddleY -= 5;
339
+ if (keys.ArrowDown && rightPaddleY < canvas.height - paddleHeight) rightPaddleY += 5;
340
+
341
+ // Движение мяча
342
+ ballX += ballSpeedX;
343
+ ballY += ballSpeedY;
344
+
345
+ // Отскок от стен
346
+ if (ballY < 0 || ballY > canvas.height - ballSize) ballSpeedY *= -1;
347
+
348
+ // Столкновение с ракетками
349
+ if ((ballX < paddleWidth && ballY > leftPaddleY && ballY < leftPaddleY + paddleHeight) ||
350
+ (ballX > canvas.width - paddleWidth - ballSize && ballY > rightPaddleY && ballY < rightPaddleY + paddleHeight)) {
351
+ paddleSound.currentTime = 0;
352
+ paddleSound.play();
353
+ ballSpeedX *= -1;
354
+ ballSpeedY += (Math.random() - 0.5) * 2;
355
+ }
356
+
357
+ // Гол
358
+ if (ballX < 0 || ballX > canvas.width) {
359
+ goalSound.currentTime = 0;
360
+ goalSound.play();
361
+ showGoalEffect(); // Добавляем эффект
362
+ if(ballX < 0) {
363
+ scoreRight++;
364
+ rightScoreElement.textContent = scoreRight;
365
+ animateScore(false);
366
+ } else {
367
+ scoreLeft++;
368
+ leftScoreElement.textContent = scoreLeft;
369
+ animateScore(true);
370
+ }
371
+ resetBall();
372
+ }
373
+
374
+ // Обработка препятствий
375
+ createObstacle();
376
+ handleObstacles();
377
+
378
+ // Проверка победы
379
+ if (scoreLeft >= 10 || scoreRight >= 10) {
380
+ isPlaying = false;
381
+ gameOverElement.style.display = 'block';
382
+ const winner = scoreLeft >= 10 ? leftPlayerName : rightPlayerName;
383
+ gameOverElement.innerHTML = `Победитель:<br>${winner}!`;
384
+ winSound.currentTime = 0;
385
+ winSound.play();
386
+ return;
387
+ }
388
+
389
+ // Отрисовка
390
+ ctx.fillStyle = 'black';
391
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
392
+
393
+ // Ракетки
394
+ ctx.fillStyle = 'white';
395
+ ctx.fillRect(0, leftPaddleY, paddleWidth, paddleHeight);
396
+ ctx.fillRect(canvas.width - paddleWidth, rightPaddleY, paddleWidth, paddleHeight);
397
+
398
+ // Мяч
399
+ ctx.beginPath();
400
+ ctx.arc(ballX + ballSize/2, ballY + ballSize/2, ballSize, 0, Math.PI*2);
401
+ ctx.fill();
402
+
403
+ // Препятствия
404
+ obstacles.forEach(obs => {
405
+ const timeLeft = OBSTACLE_LIFETIME - (Date.now() - obs.createdAt);
406
+ const alpha = Math.min(1, timeLeft / 2000);
407
+ ctx.globalAlpha = alpha;
408
+ drawObstacle(obs);
409
+ ctx.globalAlpha = 1;
410
+ });
411
+
412
+ requestAnimationFrame(gameLoop);
413
+ }
414
+
415
+ function toggleFullscreen() {
416
+ if (!document.fullscreenElement) {
417
+ canvas.requestFullscreen().catch(err => {
418
+ alert(`Ошибка при переходе в полноэкранный режим: ${err.message}`);
419
+ });
420
+ } else {
421
+ document.exitFullscreen();
422
+ }
423
+ }
424
+
425
+ // Обработчики событий
426
+ document.addEventListener('keydown', (e) => {
427
+ if (keys.hasOwnProperty(e.key)) keys[e.key] = true;
428
+ });
429
+ document.addEventListener('keyup', (e) => {
430
+ if (keys.hasOwnProperty(e.key)) keys[e.key] = false;
431
+ });
432
+ </script>
433
+ </body>
434
+ </html>
NeuroPort/HTML+APPS/Ping Pong/goal.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e843facc6fa60a90f320cf62be60ff87cbb77f538baf4a54162577fa162c2cd1
3
+ size 1049690
NeuroPort/HTML+APPS/Ping Pong/obstacle_hit.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a26a859cbe6186c5f161f23e1a35f8abfa3c713ec76a057a5880f996cd38ed1d
3
+ size 24861
NeuroPort/HTML+APPS/Ping Pong/paddle_hit.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:afca939a180777dcfe5e73761dbbfe0b245e5a81e79d95819b00fe4957a03f64
3
+ size 2310
NeuroPort/HTML+APPS/Ping Pong/win_sound.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:82b37edf577a920982d6654bad7654fc9282445f4e75bf2ec235de823d4b2473
3
+ size 1001562
NeuroPort/HTML+APPS/imagefix.exe ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6d7137e04c19973ff78de355373ab430874c55a2a7b47a0e56f9d80bfabd58a2
3
+ size 10304000
NeuroPort/HTML+APPS/mp4towebm.html ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <title>MP4 to WebM Converter</title>
6
+ <style>
7
+ body {
8
+ font-family: Arial, sans-serif;
9
+ max-width: 600px;
10
+ margin: 20px auto;
11
+ padding: 20px;
12
+ }
13
+ .container {
14
+ border: 2px dashed #ccc;
15
+ padding: 20px;
16
+ text-align: center;
17
+ }
18
+ #preview {
19
+ max-width: 100%;
20
+ margin-top: 20px;
21
+ }
22
+ .hidden {
23
+ display: none;
24
+ }
25
+ button {
26
+ padding: 10px 20px;
27
+ background: #4CAF50;
28
+ color: white;
29
+ border: none;
30
+ cursor: pointer;
31
+ margin: 10px;
32
+ }
33
+ button:disabled {
34
+ background: #cccccc;
35
+ }
36
+ </style>
37
+ </head>
38
+ <body>
39
+ <div class="container">
40
+ <h2>MP4 to WebM Converter</h2>
41
+ <input type="file" id="fileInput" accept="video/mp4">
42
+ <button id="convertBtn" disabled>Convert to WebM</button>
43
+ <a id="downloadLink" class="hidden"><button>Download WebM</button></a>
44
+ <video id="preview" controls></video>
45
+ </div>
46
+
47
+ <script>
48
+ const fileInput = document.getElementById('fileInput');
49
+ const convertBtn = document.getElementById('convertBtn');
50
+ const downloadLink = document.getElementById('downloadLink');
51
+ const preview = document.getElementById('preview');
52
+
53
+ let mediaRecorder;
54
+ let recordedChunks = [];
55
+
56
+ fileInput.addEventListener('change', async (e) => {
57
+ const file = e.target.files[0];
58
+ if (!file) return;
59
+
60
+ const url = URL.createObjectURL(file);
61
+ preview.src = url;
62
+ convertBtn.disabled = false;
63
+ });
64
+
65
+ convertBtn.addEventListener('click', async () => {
66
+ if (!preview.src) return;
67
+
68
+ try {
69
+ convertBtn.disabled = true;
70
+ convertBtn.textContent = 'Converting...';
71
+
72
+ const stream = await preview.captureStream();
73
+ recordedChunks = [];
74
+
75
+ mediaRecorder = new MediaRecorder(stream, {
76
+ mimeType: 'video/webm; codecs=vp9'
77
+ });
78
+
79
+ mediaRecorder.ondataavailable = (e) => {
80
+ if (e.data.size > 0) recordedChunks.push(e.data);
81
+ };
82
+
83
+ mediaRecorder.onstop = () => {
84
+ const blob = new Blob(recordedChunks, { type: 'video/webm' });
85
+ const url = URL.createObjectURL(blob);
86
+ downloadLink.href = url;
87
+ downloadLink.download = `converted_${Date.now()}.webm`;
88
+ downloadLink.classList.remove('hidden');
89
+ convertBtn.textContent = 'Convert to WebM';
90
+ convertBtn.disabled = false;
91
+ };
92
+
93
+ mediaRecorder.start();
94
+ preview.play();
95
+
96
+ // Остановить запись после завершения видео
97
+ preview.addEventListener('ended', () => {
98
+ mediaRecorder.stop();
99
+ });
100
+
101
+ } catch (error) {
102
+ console.error('Conversion error:', error);
103
+ alert('Error during conversion: ' + error.message);
104
+ convertBtn.textContent = 'Convert to WebM';
105
+ convertBtn.disabled = false;
106
+ }
107
+ });
108
+ </script>
109
+ </body>
110
+ </html>
NeuroPort/HTML+APPS/optimized-lava-lamp.html ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
+ <style>
6
+ body {
7
+ margin: 0;
8
+ overflow: hidden;
9
+ background: #000;
10
+ }
11
+
12
+ .lava-container {
13
+ position: fixed;
14
+ width: 100vw;
15
+ height: 100vh;
16
+ background: #000;
17
+ /* Предварительный рендеринг */
18
+ contain: layout size;
19
+ }
20
+
21
+ .lava-blob {
22
+ position: absolute;
23
+ border-radius: 50%;
24
+ /* Уменьшаем радиус размытия */
25
+ filter: blur(calc(1.5vw + 1.5vh));
26
+ mix-blend-mode: screen;
27
+ opacity: 0.6;
28
+ /* Подсказка браузеру об оптимизации */
29
+ will-change: transform;
30
+ /* Принудительное аппаратное ускорение */
31
+ transform: translateZ(0);
32
+ }
33
+
34
+ /* Предварительно определяем только 4 ключевых блоба */
35
+ .blob1 {
36
+ width: 30vw;
37
+ height: 30vw;
38
+ background: #8b0046;
39
+ animation: float1 25s ease-in-out infinite;
40
+ }
41
+
42
+ .blob2 {
43
+ width: 35vw;
44
+ height: 35vw;
45
+ background: #004b8c;
46
+ animation: float2 28s ease-in-out infinite;
47
+ }
48
+
49
+ .blob3 {
50
+ width: 25vw;
51
+ height: 25vw;
52
+ background: #4b0082;
53
+ animation: float3 24s ease-in-out infinite;
54
+ }
55
+
56
+ .blob4 {
57
+ width: 40vw;
58
+ height: 40vw;
59
+ background: #006400;
60
+ animation: float4 30s ease-in-out infinite;
61
+ }
62
+
63
+ /* Отдельные анимации для каждого блоба */
64
+ @keyframes float1 {
65
+ 0% { transform: translate(10vw, 10vh) scale(1) translateZ(0); }
66
+ 25% { transform: translate(60vw, 30vh) scale(1.1) translateZ(0); }
67
+ 50% { transform: translate(50vw, 60vh) scale(0.9) translateZ(0); }
68
+ 75% { transform: translate(20vw, 40vh) scale(1.05) translateZ(0); }
69
+ 100% { transform: translate(10vw, 10vh) scale(1) translateZ(0); }
70
+ }
71
+
72
+ @keyframes float2 {
73
+ 0% { transform: translate(60vw, 20vh) scale(1) translateZ(0); }
74
+ 30% { transform: translate(20vw, 40vh) scale(1.1) translateZ(0); }
75
+ 60% { transform: translate(40vw, 60vh) scale(0.9) translateZ(0); }
76
+ 100% { transform: translate(60vw, 20vh) scale(1) translateZ(0); }
77
+ }
78
+
79
+ @keyframes float3 {
80
+ 0% { transform: translate(30vw, 70vh) scale(1) translateZ(0); }
81
+ 40% { transform: translate(70vw, 30vh) scale(1.05) translateZ(0); }
82
+ 80% { transform: translate(20vw, 50vh) scale(0.95) translateZ(0); }
83
+ 100% { transform: translate(30vw, 70vh) scale(1) translateZ(0); }
84
+ }
85
+
86
+ @keyframes float4 {
87
+ 0% { transform: translate(70vw, 60vh) scale(1) translateZ(0); }
88
+ 33% { transform: translate(20vw, 20vh) scale(1.1) translateZ(0); }
89
+ 66% { transform: translate(50vw, 40vh) scale(0.9) translateZ(0); }
90
+ 100% { transform: translate(70vw, 60vh) scale(1) translateZ(0); }
91
+ }
92
+
93
+ .overlay {
94
+ position: fixed;
95
+ top: 0;
96
+ left: 0;
97
+ width: 100vw;
98
+ height: 100vh;
99
+ background: radial-gradient(circle at center, transparent 0%, rgba(0,0,0,0.4) 100%);
100
+ pointer-events: none;
101
+ }
102
+ </style>
103
+ </head>
104
+ <body>
105
+ <div class="lava-container">
106
+ <div class="lava-blob blob1"></div>
107
+ <div class="lava-blob blob2"></div>
108
+ <div class="lava-blob blob3"></div>
109
+ <div class="lava-blob blob4"></div>
110
+ <div class="overlay"></div>
111
+ </div>
112
+
113
+ <script>
114
+ const container = document.querySelector('.lava-container');
115
+ const colors = [
116
+ '#8b0046', // Глубокий малиновый
117
+ '#004b8c', // Глубокий синий
118
+ '#4b0082', // Индиго
119
+ '#006400', // Темно-зеленый
120
+ '#800080', // Пурпурный
121
+ '#00458b', // Темно-голубой
122
+ '#8b4500', // Темно-оранжевый
123
+ '#2f4f4f' // Темно-бирюзовый
124
+ ];
125
+
126
+ // Создаем максимум 5 дополнительных блобов, независимо от размера экрана
127
+ const maxExtraBlobs = 5;
128
+ const extraBlobsCount = Math.min(
129
+ Math.floor(Math.max(window.innerWidth, window.innerHeight) / 600) + 1,
130
+ maxExtraBlobs
131
+ );
132
+
133
+ // Создаем дополнительные блобы только при начальной загрузке
134
+ for (let i = 0; i < extraBlobsCount; i++) {
135
+ const blob = document.createElement('div');
136
+ blob.className = 'lava-blob';
137
+
138
+ // Делаем дополнительные блобы меньше основных
139
+ const size = Math.random() * 15 + 15 + 'vw';
140
+ blob.style.width = size;
141
+ blob.style.height = size;
142
+
143
+ blob.style.background = colors[Math.floor(Math.random() * colors.length)];
144
+
145
+ // Создаем для них простые анимации через CSS
146
+ blob.style.left = Math.random() * 70 + 10 + 'vw';
147
+ blob.style.top = Math.random() * 70 + 10 + 'vh';
148
+
149
+ // Добавляем простую анимацию пульсации
150
+ const duration = (Math.random() * 5 + 20) + 's';
151
+ const delay = (Math.random() * -15) + 's';
152
+ blob.style.animation = `float${i % 4 + 1} ${duration} ease-in-out infinite`;
153
+ blob.style.animationDelay = delay;
154
+
155
+ container.appendChild(blob);
156
+ }
157
+
158
+ // Никаких обработчиков движения мыши - это просто статический экран
159
+ </script>
160
+ </body>
161
+ </html>
NeuroPort/HTML+APPS/waveform_audio_player.html ADDED
@@ -0,0 +1,184 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Волновая форма аудио</title>
5
+ <style>
6
+ canvas {
7
+ border: 1px solid #ddd;
8
+ width: 100%;
9
+ height: 200px;
10
+ }
11
+ </style>
12
+ </head>
13
+ <body>
14
+
15
+ <input type="file" id="audio-file" accept="audio/*">
16
+ <canvas id="waveform"></canvas>
17
+ <div id="controls">
18
+ <button id="play">Play</button>
19
+ <button id="stop">Stop</button>
20
+ </div>
21
+
22
+ <script>
23
+ const audioFile = document.getElementById('audio-file');
24
+ const canvas = document.getElementById('waveform');
25
+ const ctx = canvas.getContext('2d');
26
+ const playButton = document.getElementById('play');
27
+ const stopButton = document.getElementById('stop');
28
+
29
+ let audioBuffer;
30
+ let audioSource;
31
+ let startTime;
32
+ let animationFrameId;
33
+ let offscreenCanvas;
34
+ let offscreenCtx;
35
+
36
+ audioFile.addEventListener('change', handleFileSelect, false);
37
+ playButton.addEventListener('click', playAudio);
38
+ stopButton.addEventListener('click', stopAudio);
39
+ canvas.addEventListener('click', seekAudio);
40
+
41
+ function handleFileSelect(event) {
42
+ const file = event.target.files[0];
43
+ const reader = new FileReader();
44
+
45
+ reader.onload = function(event) {
46
+ const audioContext = new (window.AudioContext || window.webkitAudioContext)();
47
+ audioContext.decodeAudioData(event.target.result, buffer => {
48
+ audioBuffer = buffer;
49
+ resizeCanvas();
50
+ createOffscreenCanvas();
51
+ drawOffscreenWaveform();
52
+ drawWaveform();
53
+ });
54
+ };
55
+
56
+ reader.readAsArrayBuffer(file);
57
+ }
58
+
59
+ function resizeCanvas() {
60
+ const dpr = window.devicePixelRatio || 1;
61
+ const rect = canvas.getBoundingClientRect();
62
+ canvas.width = rect.width * dpr;
63
+ canvas.height = rect.height * dpr;
64
+ ctx.scale(dpr, dpr);
65
+ }
66
+
67
+ function createOffscreenCanvas() {
68
+ offscreenCanvas = document.createElement('canvas');
69
+ offscreenCanvas.width = canvas.width;
70
+ offscreenCanvas.height = canvas.height;
71
+ offscreenCtx = offscreenCanvas.getContext('2d');
72
+ }
73
+
74
+ function drawOffscreenWaveform() {
75
+ if (!audioBuffer) return;
76
+
77
+ const channelData = audioBuffer.getChannelData(0);
78
+ const length = channelData.length;
79
+ const canvasWidth = offscreenCanvas.width;
80
+ const canvasHeight = offscreenCanvas.height;
81
+ const step = Math.ceil(length / canvasWidth);
82
+
83
+ offscreenCtx.clearRect(0, 0, canvasWidth, canvasHeight);
84
+ offscreenCtx.beginPath();
85
+
86
+ for (let i = 0; i < canvasWidth; i++) {
87
+ let min = 1.0;
88
+ let max = -1.0;
89
+
90
+ for (let j = 0; j < step; j++) {
91
+ const sample = channelData[Math.floor(i * step + j)];
92
+ if (sample < min) min = sample;
93
+ if (sample > max) max = sample;
94
+ }
95
+
96
+ const x = i;
97
+ const minY = (1 - min) * (canvasHeight / 2);
98
+ const maxY = (1 - max) * (canvasHeight / 2);
99
+
100
+ offscreenCtx.moveTo(x, minY);
101
+ offscreenCtx.lineTo(x, maxY);
102
+ }
103
+
104
+ offscreenCtx.stroke();
105
+ }
106
+
107
+ function drawWaveform() {
108
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
109
+ ctx.drawImage(offscreenCanvas, 0, 0);
110
+ drawPlaybackLine();
111
+ }
112
+
113
+ function drawPlaybackLine() {
114
+ if (!audioBuffer || !audioSource) return;
115
+
116
+ const currentTime = audioContext.currentTime - startTime;
117
+ const canvasWidth = canvas.width;
118
+ const canvasHeight = canvas.height;
119
+ const duration = audioBuffer.duration;
120
+ const playbackPosition = (currentTime / duration) * canvasWidth;
121
+
122
+ ctx.beginPath();
123
+ ctx.moveTo(playbackPosition, 0);
124
+ ctx.lineTo(playbackPosition, canvasHeight);
125
+ ctx.strokeStyle = 'red';
126
+ ctx.stroke();
127
+ }
128
+
129
+ function playAudio() {
130
+ if (!audioBuffer) return;
131
+
132
+ stopAudio();
133
+ audioContext = new (window.AudioContext || window.webkitAudioContext)();
134
+ audioSource = audioContext.createBufferSource();
135
+ audioSource.buffer = audioBuffer;
136
+ audioSource.connect(audioContext.destination);
137
+ audioSource.onended = () => {
138
+ stopAudio();
139
+ };
140
+ startTime = audioContext.currentTime;
141
+ audioSource.start();
142
+ animatePlayback();
143
+ }
144
+
145
+ function stopAudio() {
146
+ if (audioSource) {
147
+ audioSource.stop();
148
+ audioSource = null;
149
+ cancelAnimationFrame(animationFrameId);
150
+ drawWaveform();
151
+ }
152
+ }
153
+
154
+ function seekAudio(event) {
155
+ if (!audioBuffer) return;
156
+
157
+ const clickX = event.offsetX;
158
+ const canvasWidth = canvas.width;
159
+ const duration = audioBuffer.duration;
160
+ const seekTime = (clickX / canvasWidth) * duration;
161
+
162
+ if (audioSource) {
163
+ audioSource.stop();
164
+ }
165
+
166
+ audioSource = audioContext.createBufferSource();
167
+ audioSource.buffer = audioBuffer;
168
+ audioSource.connect(audioContext.destination);
169
+ audioSource.onended = () => {
170
+ stopAudio();
171
+ };
172
+ audioSource.start(0, seekTime);
173
+ startTime = audioContext.currentTime - seekTime;
174
+ animatePlayback();
175
+ }
176
+
177
+ function animatePlayback() {
178
+ drawWaveform();
179
+ animationFrameId = requestAnimationFrame(animatePlayback);
180
+ }
181
+ </script>
182
+
183
+ </body>
184
+ </html>
NeuroPort/HTML+APPS/Калькулятор СВВ-50.HTML ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="ru">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Расчет гипсовой смеси</title>
7
+ <style>
8
+ body {
9
+ font-family: Arial, sans-serif;
10
+ margin: 20px;
11
+ }
12
+ .container {
13
+ max-width: 400px;
14
+ margin: 0 auto;
15
+ }
16
+ label {
17
+ display: block;
18
+ margin-top: 10px;
19
+ }
20
+ input, select {
21
+ width: 100%;
22
+ padding: 8px;
23
+ margin-top: 5px;
24
+ }
25
+ button {
26
+ margin-top: 20px;
27
+ padding: 10px 20px;
28
+ background-color: #28a745;
29
+ color: white;
30
+ border: none;
31
+ cursor: pointer;
32
+ }
33
+ button:hover {
34
+ background-color: #218838;
35
+ }
36
+ .result {
37
+ margin-top: 20px;
38
+ padding: 10px;
39
+ background-color: #f8f9fa;
40
+ border: 1px solid #ddd;
41
+ }
42
+ </style>
43
+ </head>
44
+ <body>
45
+ <div class="container">
46
+ <h1>Расчет гипсовой смеси</h1>
47
+ <label for="volume">Объем формы (мл):</label>
48
+ <input type="number" id="volume" step="1" min="0" required>
49
+
50
+ <label for="plasticizerType">Тип пластификатора:</label>
51
+ <select id="plasticizerType">
52
+ <option value="classic">СВВ-500 Классик</option>
53
+ <option value="premium">СВВ-500 Premium</option>
54
+ </select>
55
+
56
+ <label for="plasticizerPercentage">Процент пластификатора:</label>
57
+ <select id="plasticizerPercentage">
58
+ <!-- Проценты для СВВ-500 Классик -->
59
+ <option value="1" data-type="classic">1%</option>
60
+ <option value="2" data-type="classic">2%</option>
61
+ <option value="3" data-type="classic">3%</option>
62
+ <option value="4" data-type="classic">4%</option>
63
+ <!-- Проценты для СВВ-500 Premium -->
64
+ <option value="0.3" data-type="premium">0.3%</option>
65
+ <option value="0.7" data-type="premium">0.7%</option>
66
+ <option value="1.2" data-type="premium">1.2%</option>
67
+ <option value="1.6" data-type="premium">1.6%</option>
68
+ </select>
69
+
70
+ <label for="dyePercentage">Процент красителя (0-5%):</label>
71
+ <input type="number" id="dyePercentage" min="0" max="5" value="0" required>
72
+
73
+ <button onclick="calculate()">Рассчитать</button>
74
+
75
+ <div class="result" id="result">
76
+ <h2>Результаты расчета:</h2>
77
+ <p>Гипс Г-16: <span id="gypsum"></span> г</p>
78
+ <p>Вода: <span id="water"></span> мл</p>
79
+ <p>Пластификатор: <span id="plasticizerAmount"></span> г</p>
80
+ <p>Краситель: <span id="dye"></span> г</p>
81
+ </div>
82
+ </div>
83
+
84
+ <script>
85
+ // Плотность гипса Г-16 (г/мл)
86
+ const gypsumDensity = 1.6; // 1.6 г/мл (1600 кг/м³)
87
+ // Базовое соотношение воды к гипсу (0.6 мл воды на 1 г гипса)
88
+ const baseWaterRatio = 0.6;
89
+
90
+ // Функция для обновления процентов пластификатора в зависимости от типа
91
+ function updatePlasticizerPercentages() {
92
+ const plasticizerType = document.getElementById('plasticizerType').value;
93
+ const percentageSelect = document.getElementById('plasticizerPercentage');
94
+ const options = percentageSelect.options;
95
+
96
+ for (let i = 0; i < options.length; i++) {
97
+ const option = options[i];
98
+ if (option.dataset.type === plasticizerType) {
99
+ option.hidden = false;
100
+ } else {
101
+ option.hidden = true;
102
+ }
103
+ }
104
+ // Устанавливаем первый доступный процент по умолчанию
105
+ percentageSelect.value = percentageSelect.querySelector('option:not([hidden])').value;
106
+ }
107
+
108
+ // Инициализация при загрузке страницы
109
+ document.getElementById('plasticizerType').addEventListener('change', updatePlasticizerPercentages);
110
+ updatePlasticizerPercentages();
111
+
112
+ // Основная функция расчета
113
+ function calculate() {
114
+ // Получаем данные из формы
115
+ const volume = parseFloat(document.getElementById('volume').value);
116
+ const plasticizerPercentage = parseFloat(document.getElementById('plasticizerPercentage').value);
117
+ const dyePercentage = parseFloat(document.getElementById('dyePercentage').value);
118
+
119
+ // Рассчитываем количество гипса
120
+ let gypsumAmount;
121
+ if (plasticizerPercentage === 1) {
122
+ gypsumAmount = volume * 1.37; // Коэффициент для 1%
123
+ } else if (plasticizerPercentage === 2) {
124
+ gypsumAmount = volume * 1.53; // Коэффициент для 2%
125
+ } else if (plasticizerPercentage === 3) {
126
+ gypsumAmount = volume * 1.63; // Коэффициент для 3%
127
+ } else if (plasticizerPercentage === 4) {
128
+ gypsumAmount = volume * 1.67; // Коэффициент для 4%
129
+ } else if (plasticizerPercentage === 0.3) {
130
+ gypsumAmount = volume * 1.33; // Коэффициент для 0.3%
131
+ } else if (plasticizerPercentage === 0.7) {
132
+ gypsumAmount = volume * 1.55; // Коэффициент для 0.7%
133
+ } else if (plasticizerPercentage === 1.2) {
134
+ gypsumAmount = volume * 1.6; // Коэффициент для 1.2%
135
+ } else if (plasticizerPercentage === 1.6) {
136
+ gypsumAmount = volume * 1.65; // Коэффициент для 1.6%
137
+ } else {
138
+ gypsumAmount = volume * gypsumDensity; // По умолчанию
139
+ }
140
+
141
+ // Рассчитываем количество воды
142
+ let waterAmount;
143
+ if (plasticizerPercentage === 1) {
144
+ waterAmount = gypsumAmount * 0.35; // Коэффициент для 1%
145
+ } else if (plasticizerPercentage === 2) {
146
+ waterAmount = gypsumAmount * 0.28; // Коэффициент для 2%
147
+ } else if (plasticizerPercentage === 3) {
148
+ waterAmount = gypsumAmount * 0.24; // Коэффициент для 3%
149
+ } else if (plasticizerPercentage === 4) {
150
+ waterAmount = gypsumAmount * 0.22; // Коэффициент для 4%
151
+ } else if (plasticizerPercentage === 0.3) {
152
+ waterAmount = gypsumAmount * 0.375; // Коэффициент для 0.3%
153
+ } else if (plasticizerPercentage === 0.7) {
154
+ waterAmount = gypsumAmount * 0.26; // Коэффициент для 0.7%
155
+ } else if (plasticizerPercentage === 1.2) {
156
+ waterAmount = gypsumAmount * 0.25; // Коэффициент для 1.2%
157
+ } else if (plasticizerPercentage === 1.6) {
158
+ waterAmount = gypsumAmount * 0.23; // Коэффициент для 1.6%
159
+ } else {
160
+ waterAmount = gypsumAmount * baseWaterRatio; // По умолчанию
161
+ }
162
+
163
+ // Рассчитываем количество пластификатора
164
+ const plasticizerAmount = (gypsumAmount * plasticizerPercentage) / 100;
165
+ // Рассчитываем количество красителя
166
+ const dyeAmount = (gypsumAmount * dyePercentage) / 100;
167
+
168
+ // Выводим результаты
169
+ document.getElementById('gypsum').textContent = gypsumAmount.toFixed(2);
170
+ document.getElementById('water').textContent = waterAmount.toFixed(2);
171
+ document.getElementById('plasticizerAmount').textContent = plasticizerAmount.toFixed(2);
172
+ document.getElementById('dye').textContent = dyeAmount.toFixed(2);
173
+ }
174
+ </script>
175
+ </body>
176
+ </html>