Move a player with WASD — but instead of the usual 8 directions, the movement vector is the vector sum of analog key depths read over WebHID from an analog keyboard (Wooting, Razer, …).
Two players run side by side from the same input and the same formula:
| input representation | result | |
|---|---|---|
| Analog player (solid) | raw depths 0..1 | 360° direction, variable speed |
| Digital ghost (dashed) | depth >= actuation ? 1 : 0 |
snaps to 8 directions, always full speed |
The only difference between the two trails is the input representation — that divergence is the whole demo.
Every HID report delivers the four depths
Feed the same formula binary 0/1 depths and it degenerates to 8-way movement by itself — no separate ghost logic needed.
Actuation point, deadzone, gamma, and max speed are adjustable live with sliders.
WebHID needs a secure context, so serve locally:
python3 -m http.server 8000 # http://localhost:8000Open the page in a Chromium-based browser, click Connect, and pick your analog keyboard. Without one, keys fall back to digital 0/1 — both players then move identically, which is itself the point.
If your device doesn't show up in the picker, open hid-debug.html to inspect
what usagePage it exposes (see TROUBLESHOOTING.md for
the known Wooting V1→V2 interface change).
- Analog input via AnalogSense/JavaScript-SDK
(vendored as
AnalogSense.js, unmodified). - Extracted from the live-visualization part of my keystroke-demo project.
MIT
