V.
VIGHNESH KUMBHAR01 / 01

Gesture Three.js

Universal 3D gesture control library with MediaPipe Hands + Three.js. Zero runtime dependencies, ~18KB gzipped. Provides pinch, grab, point, swipe gestures for any Three.js scene.

Active repository

Gesture Three.js source screenshot
MP_3D
GESTURE / LIBCASE / 23
VERIFIED SOURCE MATERIALTypeScript / MediaPipe HandLandmarker / Three.js

The premise.

gesture-threejs is a lightweight TypeScript library that bridges MediaPipe Hand Landmarker with Three.js scenes. Exposes a clean React-like hook API: useGestures(scene, camera) returns gesture events (pinch, grab, point, swipe) mapped to 3D interactions (rotate, scale, translate, select).

Adding gesture control to 3D web apps requires boilerplate MediaPipe setup, coordinate mapping, and gesture classification. This library abstracts all of it.

How it is structured.

The repository evidence points to these observable boundaries and technologies:

  • TypeScript library with Rollup bundling
  • MediaPipe Tasks Vision (HandLandmarker) via CDN
  • Three.js peer dependency
  • React hooks + vanilla JS API
  • Gesture classification: pinch/grab/point/swipe

From idea to system.

  • useGestures() hook for React
  • createGestureController() for vanilla JS
  • Automatic MediaPipe model loading from CDN
  • Normalized screen → 3D world coordinate mapping
  • Configurable gesture sensitivity and debouncing
  • Tree-shakable: import only needed gestures
TypeScriptMediaPipe HandLandmarkerThree.jsRollupViteESM

The difficult parts.

  • MediaPipe GPU delegate inconsistency across browsers
  • Normalized landmark → Three.js world space math
  • Library size vs feature completeness tradeoff
  • TypeScript declarations for MediaPipe types

What can be said honestly.

  • ~18KB gzipped (zero runtime deps beyond Three.js)
  • Demo: orbit controls via pinch, object selection via point
  • Works in Chrome/Edge/Firefox with webcam permission
  • TypeScript definitions included

Gesture libraries succeed when they handle the messy coordinate math and leave interaction design to the app. MediaPipe CDN loading simplifies distribution.