-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbubble-display3.html
More file actions
437 lines (377 loc) · 19.8 KB
/
bubble-display3.html
File metadata and controls
437 lines (377 loc) · 19.8 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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
<!DOCTYPE html>
<html lang="pt-pt">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>QDSP-6064 Bubble Display Simulator</title>
<style>
body { margin: 0; background-color: #000; overflow: hidden; font-family: 'Segoe UI', sans-serif; touch-action: manipulation; }
#loading {
position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
color: #ff3300; font-family: monospace; letter-spacing: 2px; z-index: 2000;
}
#toast {
position: absolute; top: -60px; left: 50%; transform: translateX(-50%);
background: rgba(255, 50, 0, 0.95); color: white; padding: 12px 30px;
border-radius: 30px; font-weight: bold; font-size: 13px; z-index: 3000;
transition: top 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
text-transform: uppercase; letter-spacing: 1.5px; box-shadow: 0 5px 25px rgba(255, 50, 0, 0.6);
white-space: nowrap; pointer-events: none;
}
#toast.active { top: 30px; }
#gear-icon {
position: absolute; top: 20px; right: 20px; width: 44px; height: 44px;
background: rgba(30, 0, 0, 0.5); border: 1px solid rgba(170, 0, 0, 0.6);
border-radius: 50%; display: flex; align-items: center; justify-content: center;
cursor: pointer; z-index: 1100; color: #ff3300;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
#gear-icon:hover { background: rgba(80, 0, 0, 0.7); transform: rotate(45deg); }
#ui-window {
position: absolute; top: 80px; right: 20px; width: 240px;
background: transparent; border: none; padding: 10px; color: #ff7777;
font-size: 11px; z-index: 1000; display: none; user-select: none;
max-height: 80vh; overflow-y: auto;
}
#ui-window.active { display: block; animation: fadeIn 0.3s ease-out; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.section-title {
font-weight: bold; margin-bottom: 18px; border-bottom: 1px solid rgba(255, 255, 255, 0.1);
padding-bottom: 10px; font-size: 13px; color: #fff; text-align: left;
text-transform: uppercase; letter-spacing: 2px; cursor: pointer;
}
.control-group { margin-bottom: 16px; }
.control-group label { display: block; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 1px; font-weight: bold; color: rgba(255, 68, 68, 0.8); }
input[type=range] {
width: 100%; cursor: pointer; accent-color: #ff0000;
background: rgba(255, 255, 255, 0.1); height: 5px; border-radius: 2px; appearance: none;
}
.val-display { float: right; color: #ffffff; font-family: monospace; opacity: 0.9; font-size: 10px; }
.checkbox-group {
display: flex; align-items: center; justify-content: space-between;
gap: 10px; cursor: pointer; margin-top: 15px; padding: 5px 0;
}
.checkbox-group input { width: 20px; height: 20px; cursor: pointer; accent-color: #ff0000; }
#ui-label {
position: absolute; bottom: 15px; width: 100%; text-align: center;
color: rgba(255, 50, 0, 0.2); font-size: 8px; letter-spacing: 3px; pointer-events: none;
text-transform: uppercase;
}
</style>
</head>
<body>
<div id="loading">A CALIBRAR ÓPTICA QDSP-6064...</div>
<div id="toast">Ação Concluída!</div>
<div id="gear-icon" onclick="toggleUI(event)">
<svg viewBox="0 0 24 24" width="24" height="24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="3"></circle>
<path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path>
</svg>
</div>
<div id="ui-window" onclick="event.stopPropagation()">
<div id="ui-title" class="section-title">QDSP-6064 MEMORY</div>
<div class="control-group">
<label>Brilho LED <span id="val-emit" class="val-display">800</span></label>
<input type="range" id="input-emit" min="0" max="2500" value="800">
</div>
<div class="control-group">
<label>Refração (IOR) <span id="val-ior" class="val-display">3.80</span></label>
<input type="range" id="input-ior" min="1.0" max="5.0" step="0.1" value="3.8">
</div>
<div class="control-group">
<label>Poder da Lente <span id="val-mag" class="val-display">1.00</span></label>
<input type="range" id="input-mag" min="1.0" max="25.0" step="0.5" value="1.0">
</div>
<div class="control-group">
<label>Nitidez Display <span id="val-sharp" class="val-display">0.80</span></label>
<input type="range" id="input-sharp" min="0.0" max="1.0" step="0.01" value="0.80">
</div>
<div class="control-group">
<label>Opacidade Display <span id="val-alpha" class="val-display">0.92</span></label>
<input type="range" id="input-alpha" min="0.0" max="1.0" step="0.01" value="0.92">
</div>
<div class="control-group">
<label>Estúdio <span id="val-light" class="val-display">1.10</span></label>
<input type="range" id="input-light" min="0" max="5" step="0.1" value="1.1">
</div>
<div class="checkbox-group">
<label for="check-rotate" style="margin-bottom:0; cursor:pointer; flex:1">Oscilação (±90°)</label>
<input type="checkbox" id="check-rotate">
</div>
<div style="font-size: 8px; opacity: 0.4; text-align: center; margin-top: 15px; line-height: 1.4;">
TOQUE 2 VEZES NO TÍTULO PARA COPIAR JSON<br>
TOQUE 3 VEZES NA TELA PARA GUARDAR
</div>
</div>
<div id="ui-label">QDSP-6064 | CONFIGURAÇÃO DE FÁBRICA ATUALIZADA</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/three@0.128.0/examples/js/controls/OrbitControls.js"></script>
<script>
let scene, camera, renderer, controls;
let ambientLight, directionalLight;
const digitData = [];
const lensMaterials = [];
const ledGroups = [];
let barMaterial;
let orbitDirection = -1;
const ROTATE_LIMIT = 1.57;
// Parâmetros Iniciais conforme o JSON fornecido pelo usuário
let params = {
emissiveIntensity: 800,
ior: 3.8,
magnification: 1.0,
sharpness: 0.8,
opacity: 0.92,
lightIntensity: 1.1,
autoRotate: true,
cameraPos: {
x: 12.070529703242643,
y: 3.2643492617340257,
z: 11.842114002466948
},
cameraTarget: {
x: -0.25313588023033134,
y: 0.4350403748474412,
z: 0.30231288943098744
}
};
const segmentMap = {
'0': [1,1,1,1,1,1,0,0], '1': [0,1,1,0,0,0,0,0], '2': [1,1,0,1,1,0,1,0],
'3': [1,1,1,1,0,0,1,0], '4': [0,1,1,0,0,1,1,0], '5': [1,0,1,1,0,1,1,0],
'6': [1,0,1,1,1,1,1,0], '7': [1,1,1,0,0,0,0,0], '8': [1,1,1,1,1,1,1,0],
'9': [1,1,1,1,0,1,1,0], ' ': [0,0,0,0,0,0,0,0]
};
let tapCount = 0;
let lastTapTime = 0;
let titleTapCount = 0;
let lastTitleTapTime = 0;
window.onload = function() {
try {
loadSettings(); // Tenta carregar do localStorage se existir
init();
setupUI();
setupGestures();
animate();
} catch (e) {
console.error(e);
} finally {
document.getElementById('loading').style.display = 'none';
}
};
function loadSettings() {
const saved = localStorage.getItem('qdsp6064_custom_v1');
if (saved) {
try {
const parsed = JSON.parse(saved);
params = { ...params, ...parsed };
} catch(e) {}
}
}
function saveSettings() {
params.cameraPos = { x: camera.position.x, y: camera.position.y, z: camera.position.z };
params.cameraTarget = { x: controls.target.x, y: controls.target.y, z: controls.target.z };
localStorage.setItem('qdsp6064_custom_v1', JSON.stringify(params));
showToast("Configuração Guardada!");
}
function showToast(msg) {
const toast = document.getElementById('toast');
toast.innerText = msg;
toast.classList.add('active');
setTimeout(() => toast.classList.remove('active'), 2500);
}
function copyToClipboard(text) {
const textArea = document.createElement("textarea");
textArea.value = text;
document.body.appendChild(textArea);
textArea.select();
try {
document.execCommand('copy');
showToast("JSON Copiado!");
} catch (err) {
showToast("Erro ao copiar.");
}
document.body.removeChild(textArea);
}
function setupGestures() {
window.addEventListener('pointerdown', (e) => {
if (e.target.closest('#ui-window') || e.target.closest('#gear-icon')) return;
const now = Date.now();
if (now - lastTapTime < 400) tapCount++;
else tapCount = 1;
lastTapTime = now;
if (tapCount === 3) { saveSettings(); tapCount = 0; }
}, { passive: true });
const title = document.getElementById('ui-title');
title.addEventListener('pointerdown', (e) => {
const now = Date.now();
if (now - lastTitleTapTime < 400) titleTapCount++;
else titleTapCount = 1;
lastTitleTapTime = now;
if (titleTapCount === 2) {
const exportData = {
...params,
cameraPos: { x: camera.position.x, y: camera.position.y, z: camera.position.z },
cameraTarget: { x: controls.target.x, y: controls.target.y, z: controls.target.z },
timestamp: new Date().toISOString()
};
copyToClipboard(JSON.stringify(exportData, null, 2));
titleTapCount = 0;
}
});
}
function toggleUI(e) {
if(e) e.stopPropagation();
document.getElementById('ui-window').classList.toggle('active');
}
function setupUI() {
const bindControl = (id, valId, paramKey, callback) => {
const el = document.getElementById(id);
const disp = document.getElementById(valId);
el.value = params[paramKey];
disp.innerText = (typeof params[paramKey] === 'number') ? params[paramKey].toFixed(2) : params[paramKey];
el.addEventListener('input', (e) => {
const val = parseFloat(e.target.value);
params[paramKey] = val;
disp.innerText = val.toFixed(2);
if(callback) callback(val);
});
};
bindControl('input-emit', 'val-emit', 'emissiveIntensity');
bindControl('input-ior', 'val-ior', 'ior', (val) => { lensMaterials.forEach(m => m.ior = val); });
bindControl('input-mag', 'val-mag', 'magnification', (val) => {
lensMaterials.forEach(m => m.thickness = val);
const zOffset = (val / 55);
ledGroups.forEach(group => { group.position.z = -0.05 - zOffset; });
});
bindControl('input-sharp', 'val-sharp', 'sharpness', (val) => {
const roughness = 1.0 - val;
lensMaterials.forEach(m => { m.roughness = roughness * 0.85; m.clearcoat = val; m.clearcoatRoughness = roughness; });
if(barMaterial) { barMaterial.roughness = roughness * 0.4; barMaterial.clearcoat = val * 0.8; }
});
bindControl('input-alpha', 'val-alpha', 'opacity', (val) => {
lensMaterials.forEach(m => m.transmission = val);
if(barMaterial) barMaterial.transmission = val;
});
bindControl('input-light', 'val-light', 'lightIntensity', (val) => {
directionalLight.intensity = val;
ambientLight.intensity = val * 0.2;
});
const rotCheck = document.getElementById('check-rotate');
rotCheck.checked = params.autoRotate;
rotCheck.addEventListener('change', (e) => {
params.autoRotate = e.target.checked;
controls.autoRotate = params.autoRotate;
});
}
function init() {
scene = new THREE.Scene();
scene.background = new THREE.Color(0x000000);
camera = new THREE.PerspectiveCamera(35, window.innerWidth / window.innerHeight, 0.1, 1000);
camera.position.set(params.cameraPos.x, params.cameraPos.y, params.cameraPos.z);
renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true });
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.outputEncoding = THREE.sRGBEncoding;
renderer.toneMapping = THREE.ReinhardToneMapping;
renderer.toneMappingExposure = 3.5;
document.body.appendChild(renderer.domElement);
controls = new THREE.OrbitControls(camera, renderer.domElement);
controls.enableDamping = true;
controls.dampingFactor = 0.05;
controls.target.set(params.cameraTarget.x, params.cameraTarget.y, params.cameraTarget.z);
controls.autoRotate = params.autoRotate;
controls.autoRotateSpeed = -3.0;
ambientLight = new THREE.AmbientLight(0xffffff, params.lightIntensity * 0.2);
scene.add(ambientLight);
directionalLight = new THREE.DirectionalLight(0xffffff, params.lightIntensity);
directionalLight.position.set(5, 10, 15);
scene.add(directionalLight);
createBubbleClock();
}
function createBubbleClock() {
const digitCount = 6;
const spacing = 1.05;
const boxThickness = 0.08;
const boxHeight = 1.25;
const lensRadius = 0.52;
barMaterial = new THREE.MeshPhysicalMaterial({
color: 0x330000, transparent: true, transmission: params.opacity,
ior: 1.49, thickness: 0.1, roughness: (1.0 - params.sharpness) * 0.4,
metalness: 0.05, clearcoat: params.sharpness * 0.8
});
const group = new THREE.Group();
const barGeo = new THREE.BoxGeometry(digitCount * spacing + 0.4, boxHeight, boxThickness);
const bar = new THREE.Mesh(barGeo, barMaterial);
bar.renderOrder = 2;
group.add(bar);
const startX = -((digitCount - 1) * spacing) / 2;
for(let i = 0; i < digitCount; i++) {
const dx = startX + (i * spacing);
const lensMat = new THREE.MeshPhysicalMaterial({
color: 0xff0000, transparent: true, transmission: params.opacity,
ior: params.ior, thickness: params.magnification,
roughness: (1.0 - params.sharpness) * 0.8, specularIntensity: 2.0,
clearcoat: params.sharpness, clearcoatRoughness: 1.0 - params.sharpness,
depthWrite: true
});
lensMaterials.push(lensMat);
const lensGeo = new THREE.SphereGeometry(lensRadius, 64, 48, 0, Math.PI * 2, 0, Math.PI / 2);
const lens = new THREE.Mesh(lensGeo, lensMat);
lens.rotation.x = Math.PI / 2; lens.position.set(dx, 0, boxThickness / 2);
lens.renderOrder = 10; group.add(lens);
const ledContainer = new THREE.Group();
const zOffset = (params.magnification / 55);
ledContainer.position.set(dx, 0, -boxThickness / 2 - zOffset);
ledContainer.scale.set(0.42, 0.42, 1);
group.add(ledContainer);
ledGroups.push(ledContainer);
const segments = [];
const makeSeg = (px, py, rot, isDot = false) => {
const geo = isDot ? new THREE.CircleGeometry(0.08, 16) : new THREE.PlaneGeometry(0.4, 0.04);
const mat = new THREE.MeshStandardMaterial({ color: 0x000000, emissive: 0xff0000, emissiveIntensity: 0 });
const s = new THREE.Mesh(geo, mat);
s.position.set(px, py, 0); s.rotation.z = rot; ledContainer.add(s);
return s;
};
segments.push(makeSeg(0, 0.35, 0)); segments.push(makeSeg(0.18, 0.18, Math.PI/2));
segments.push(makeSeg(0.18, -0.18, Math.PI/2)); segments.push(makeSeg(0, -0.35, 0));
segments.push(makeSeg(-0.18, -0.18, Math.PI/2)); segments.push(makeSeg(-0.18, 0.18, Math.PI/2));
segments.push(makeSeg(0, 0, 0)); segments.push(makeSeg(0.35, -0.35, 0, true));
digitData.push(segments);
}
scene.add(group);
}
function updateClock() {
const now = new Date();
const timeStr = now.getHours().toString().padStart(2, '0') + now.getMinutes().toString().padStart(2, '0') + now.getSeconds().toString().padStart(2, '0');
const blink = now.getMilliseconds() > 500;
for(let i=0; i < 6; i++) {
if(!digitData[i]) continue;
const char = timeStr[i] || ' ';
const pattern = [...(segmentMap[char] || segmentMap[' '])];
if((i === 1 || i === 3) && blink) pattern[7] = 1;
digitData[i].forEach((seg, idx) => {
seg.material.emissiveIntensity = pattern[idx] ? params.emissiveIntensity / 100 : 0;
});
}
}
function animate() {
requestAnimationFrame(animate);
updateClock();
if (params.autoRotate) {
const azimuth = controls.getAzimuthalAngle();
if (azimuth >= ROTATE_LIMIT) orbitDirection = 1;
else if (azimuth <= -ROTATE_LIMIT) orbitDirection = -1;
controls.autoRotateSpeed = orbitDirection * 3.0;
}
if(controls) controls.update();
renderer.render(scene, camera);
}
window.onresize = function() {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
};
</script>
</body>
</html>