Handwave
03 — Tuning

Four numbers do all the work.

They sit at the top of assets/gesture.js. Change one at a time and reload — the interaction changes character fast.

PINCH_RATIO — 0.38

How close thumb and index have to be, as a fraction of palm width. Lower it if the page grabs when you did not mean to pinch. Raise it if you are squeezing hard and nothing happens. Around 0.30 the gesture becomes a firm deliberate pinch, and past 0.50 a loosely cupped hand starts registering.

SCROLL_GAIN — 2600

Pixels of scroll per unit of hand travel, where one unit is the full height of the camera frame. At 2600 a comfortable hand movement of roughly a third of the frame moves you about 900 pixels, which is a screen or so. This is the number people re-tune the most, and it is pure feel — there is no correct answer, only what stops you reaching.

If you have long pages and a small camera frame, raise it. If precise stopping matters more than covering ground, lower it.

SWIPE_SPEED — 1.15

Frame widths per second the wrist must exceed to count as a flick. Raise it and only sharp intentional swipes register, which is the right call if you gesture a lot while talking. Lower it and gentle sweeps work, at the cost of the occasional accidental page change.

COOLDOWN — 1100 ms

How long swipes are ignored after one fires. It has to outlast both the tail of your hand movement and the page transition, or the second page inherits the momentum of the first swipe. If double-jumps happen, this is the number to raise before touching anything else.

A tuning order that works.

Start with the pinch threshold, because everything else is harder to judge while the grab is unreliable. Then set the scroll gain by reading a real page rather than a test pattern. Then the swipe speed, deliberately trying to trigger it by accident. The cooldown comes last and usually needs no change at all.

Whatever you land on, tune it in the light you will actually use it in. Detection confidence drops in a dim room, landmarks get noisier, and thresholds that felt crisp at midday go vague by evening.