glove_visualizer / index.html
nepyope's picture
Homunculus glove viewer
af93715 verified
Raw History Blame Contribute Delete
6.09 kB
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Homunculus · Hand Lab</title>
<meta name="description" content="Explore a two-joint hand model, connect a Homunculus glove, calibrate finger attachments, and inspect live IK poses." />
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='6' fill='%2308080c'/%3E%3Cpath d='M7 25L16 16L24 7' fill='none' stroke='%23ff7a2f' stroke-width='4'/%3E%3Ccircle cx='7' cy='25' r='3' fill='%2353d6c5'/%3E%3Ccircle cx='16' cy='16' r='3' fill='%2353d6c5'/%3E%3Ccircle cx='24' cy='7' r='3' fill='%2353d6c5'/%3E%3C/svg%3E" />
<link rel="stylesheet" href="./src/glove.css" />
<style>
:root {
--ink: #08080c;
--orange: #ff7a2f;
--mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
html, body { margin: 0; height: 100%; background: var(--ink); overflow: hidden; }
canvas { display: block; }
/* Camcorder-style OSD, carried over from the g1 viewer. */
#osd {
position: fixed; inset: 0; z-index: 2; pointer-events: none;
font-family: var(--mono); color: rgba(255,255,255,.85);
font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
}
#osd .box { position: absolute; padding: 10px 12px; line-height: 1.7; }
#tl { top: 14px; left: 16px; }
#tr { top: 14px; right: 16px; text-align: right; }
#bl { bottom: 14px; left: 16px; color: rgba(255,255,255,.45); }
#br { bottom: 14px; right: 16px; text-align: right; color: rgba(255,255,255,.45); }
.accent { color: var(--orange); }
.dim { color: rgba(255,255,255,.45); }
#rec { color: var(--orange); }
#rec b { animation: blink 1.1s steps(1,end) infinite; }
@keyframes blink { 50% { opacity: 0; } }
/* Cheap CRT feel without a post-processing pass: scanlines + vignette. */
#crt {
position: fixed; inset: 0; z-index: 3; pointer-events: none;
background:
repeating-linear-gradient(to bottom, rgba(0,0,0,.16) 0 1px, transparent 1px 3px),
radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.55) 100%);
mix-blend-mode: multiply;
}
/* #osd ignores the pointer so orbiting works anywhere; controls opt back in. */
#tabs { position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
display: flex; gap: 8px; pointer-events: auto; }
.pbtn {
font: inherit; font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
color: rgba(255,255,255,.7); background: rgba(255,255,255,.06);
border: 1px solid rgba(255,255,255,.16); border-radius: 2px;
padding: 6px 12px; cursor: pointer;
}
.pbtn:hover:not(:disabled) { color: #fff; border-color: rgba(255,255,255,.4); }
.pbtn.on { color: var(--ink); background: var(--orange); border-color: var(--orange); }
.pbtn.ghost { color: rgba(255,255,255,.45); }
.pbtn:disabled { opacity: .35; cursor: default; }
.pbtn.loading { animation: blink .8s steps(1,end) infinite; }
/* Controls dock on the right, scrolling when a model exposes 23 of them. */
#controls {
position: absolute; top: 56px; right: 16px; bottom: 56px; width: 300px;
display: flex; flex-direction: column; gap: 10px;
overflow-y: auto; pointer-events: auto; scrollbar-width: thin;
}
.cgroup { border: 1px solid rgba(255,255,255,.12); background: rgba(8,8,12,.6);
backdrop-filter: blur(4px); padding: 8px 10px; }
.ctitle { color: var(--orange); font-size: 10px; margin-bottom: 6px; }
.cbody { display: flex; flex-direction: column; gap: 3px; }
.crow { display: grid; grid-template-columns: 84px 1fr 40px; align-items: center; gap: 6px; }
.cname { font-size: 9px; color: rgba(255,255,255,.5); overflow: hidden;
text-overflow: ellipsis; white-space: nowrap; }
.cval { font-size: 9px; color: rgba(255,255,255,.75); text-align: right; }
.crow input[type=range] { -webkit-appearance: none; appearance: none; width: 100%;
height: 2px; background: rgba(255,255,255,.2); outline: none; }
.crow input[type=range]::-webkit-slider-thumb {
-webkit-appearance: none; width: 10px; height: 10px; border-radius: 50%;
background: var(--orange); cursor: pointer;
}
.crow input[type=range]::-moz-range-thumb {
width: 10px; height: 10px; border: 0; border-radius: 50%;
background: var(--orange); cursor: pointer;
}
#boot {
position: fixed; inset: 0; z-index: 4; display: grid; place-content: center;
background: var(--ink); font-family: var(--mono); color: var(--orange);
font-size: 13px; letter-spacing: .1em; text-transform: uppercase; white-space: pre;
text-align: center;
}
#boot.done { display: none; }
#boot.failed { color: #ff4d4d; }
</style>
</head>
<body>
<div id="osd">
<div class="box" id="tl">
<div id="rec"><b>●</b> <span id="model"></span></div>
<div id="subline" class="dim"></div>
</div>
<!-- One line only: the controls dock sits directly below this corner. -->
<div class="box" id="tr">
<div id="joint" class="accent">&nbsp;</div>
</div>
<div id="tabs"></div>
<section id="glove-input" aria-label="Glove input and hand calibration" hidden></section>
<div id="controls"></div>
<div class="box" id="bl">
<div id="hint">drag a slider to pose a joint</div>
<div class="dim">drag to orbit · scroll zoom · f fist · r zero</div>
</div>
<div class="box" id="br">
<div id="stats"></div>
</div>
</div>
<div id="crt"></div>
<div id="boot">booting…</div>
<script type="importmap">
{
"imports": {
"three": "./vendor/three.module.js",
"three/addons/": "./vendor/addons/"
}
}
</script>
<script type="module">
import { main } from "./src/main.js";
const boot = document.getElementById("boot");
main((msg) => { boot.textContent = msg; })
.then(() => boot.classList.add("done"))
.catch((e) => {
boot.classList.add("failed");
boot.textContent = `SYSTEM HALTED\n\n${e.message}`;
console.error(e);
});
</script>
</body>
</html>