inspired by the weird hand overlay on X. a helping hand for your website.
Files
README.md

helping hand #

a hand for your websites.

A hand cut out of video: thirteen real poses, each its own silhouette and mesh, rigged in 2D and animated over the page with a stretchy flannel sleeve. Point, flip, and push things around with the fingertip.

demo

Embed #

Ship dist/handlib.js and a hand atlas (copy public/hand/).

<script type="module" src="/dist/handlib.js"></script>
<floating-hand src="/hand/" size="320" anchor-x="0.7" anchor-y="0.5"></floating-hand>
Attribute Default
src ./hand/ atlas directory
size 640 reference hand height, px
anchor-x, anchor-y 0.76, 0.7 viewport fractions
mirror off opposite chirality
side dorsal palmar starts face up
smoothing 0.4 0 snappy … 1 heavy
debug texture solid, weights, wireframe, bones

The element adds one fixed, pointer-transparent canvas; it does not listen to input. Drive it:

const hand = document.querySelector("floating-hand");
await hand.ready;

hand.setCursor(x, y);            // aim point (the fingertip when pointing)
hand.setVelocity(vx, vy);        // aim direction
hand.setSmoothing(0.5);
hand.togglePointing();
const tip = hand.getTipScreen(); // CSS px, for hit-testing

Programmatic:

import { Hand, loadHandLibrary } from "/dist/handlib.js";
const hand = new Hand(await loadHandLibrary("/hand/"), { size: 320, x, y });

API #

setPosition(x, y, immediate?), setCursor, setVelocity, setRoll, setSmoothing, setSize, setOrigin, play(name, ctx), pointAt, pointWith, togglePointing, cycleFinger, flip, setSide, setPose, getTipScreen, getPalmScreen, setDebug, destroy.

Getters: ready, hand, pointing, finger, poseName. Events: hand-ready, hand-swat ({ x, y, direction }).

Demo #

bun run build
bun run serve   # http://localhost:4173

Left press points, right press flips, wheel changes the pointing finger. Press and hold while pointing and sweep a block to push it. w/o/u/d play gestures, b cycles render modes.

How it works #

  • One mesh per real pose (open, palm, points, thumbs, fist), crossfaded — the shapes come from the footage, not a 3D model.
  • Skinned in 2D, rotated with a weak 3D projection; aim, roll, wrist and anchor are springs. mirror flips chirality.
  • A ribbon sleeve from a fixed elbow; the cuff is drawn over the wrist cut.
hand/
  poses/manifest.json   pose list
  poses/<name>.json     mesh, bones, weights
  poses/<name>.webp     RGBA texture
  rig.json              sleeve metrics
  arm-cuff.webp         cuff band
  arm-tile.webp         flannel tile