Lightning Hands
A blue-white electric arc stretches between your index fingers and follows the gap between your hands, on your webcam — or with the cursor, no camera.
Updated
This effect is part of Effect.Labs — 846 vanilla effects, some free, some premium. Gestures & Webcam has 11 effects, all premium. Explore the category →
3 usage examples



How it works
The script has two parts. The first one, the base, builds a list of hands on every frame, 21 points each. The second one only draws, on a transparent 2D canvas with additive blending: a faint skeleton, a red dot on each fingertip, a hexagonal ring around the index finger, then the arcs. The main arc links both index fingers and never switches off; two thinner arcs (thumbs, middle fingers) and four small arcs between neighbouring fingers of each hand light up for 0.5 to 1.4 s at a time.
Each arc has one node every 15 px (4 to 44 of them), moved by two slow waves and a fast zigzag: the path quivers without ever jumping between frames. Up to four branches appear and die out within 0.2 to 0.45 s, sparks fly from both ends (160 at most), and every stroke is painted four times, from an 18 px halo down to a 1.7 px white core. Brightness rises in short surges at least 0.45 s apart: no flash ever fills the screen.
By default no camera is opened: this is demo mode. The index fingertip of a ghost hand sits on the cursor (mouse, finger or pen) and a second hand faces it; after 2.5 s without movement both hands go back to swaying on their own. The three examples and the captures on this page run in that mode, with the code you buy.
Clicking “Turn camera on” asks the browser for permission and, at the same time, loads the MediaPipe hand detector (a module from cdn.jsdelivr.net, a model from storage.googleapis.com). Detection then runs inside the page: the webcam picture, mirrored under the lightning, goes nowhere. A single transmission still happens, decided by MediaPipe: after the first minute, then minute by minute during detection, the library sends Google (odml.pa.googleapis.com) a few counters — version number, kind of detector, processing times. No photo, no finger coordinates: still worth mentioning in your privacy policy. The camera stops on the second click, when the scene leaves the screen, when the tab is hidden or when another scene on the page starts its own.
Accessibility
- Keyboard: the camera button is a real
<button>witharia-pressed, reached on the first Tab (Option+Tab in Safari unless its default setting was changed), triggered by Enter or Space, with a 2 px focus ring. Demo mode has no keyboard control: without a pointer the ghost hands play by themselves, so keyboard users miss nothing. - Status messages: loading, camera on, “no hand detected”, refusals and failures are written into a
role="status"pill announced by screen readers. Canvas and video arearia-hidden; the scene carries anaria-labelyou should adapt to your content. - Reduced motion: arcs frozen on a fixed path, three still branches, no sparks, no surges, ghost hands at rest. The hand still follows the cursor, since the visitor is the one moving it, then glides back to its place once the cursor stops.
- Touch: dragging a finger sideways moves the hand; dragging up or down scrolls the page as usual (
touch-action: pan-y). Once the finger lifts, the demo resumes on its own. Measured in Chromium with touch emulation, not on a real phone. - Light: no full-screen flash, at most 2.2 brightness changes per second, below the 3-per-second threshold of WCAG 2.3.1. The
.hlx-solidclass on the scene halves arc brightness and darkens the video.
Browser compatibility
Demo mode: 2D canvas and pointer events, 36 KB of unminified JavaScript, no dependency. In WebKit 26.5, as in Chromium 149 and Firefox 151, two independent scenes run on one page, with no network request and the loop stopped off screen. Camera mode measured with the fake camera of Chromium 149 and Firefox 151: four downloads (about 20 MB, two domains), then MediaPipe's usage record every minute, stream closed on stop; not verified in Safari, whose test engine has no fake camera. The page must be served over https (or localhost).
Camera refused, missing, busy or blocked by the page: a message says so for 10 s and the cursor demo never stopped running. Detection module unreachable (offline, CSP): same fallback, and a new click tries again. Without aspect-ratio (before Chrome 88, Firefox 89, Safari 15) the scene is 300 px tall. Without JavaScript, a dark frame remains with the button and the privacy sentence.
The code
HTML structure to paste into your page (the CSS + JS come with your purchase):
<div class="fx-0844-root">
<div class="hlx-scene" data-hlx-lang="en" role="region" aria-label="Lightning Hands — electric arcs between your fingertips. Cursor demo, camera on request (processed on your device only)">
<video class="hlx-video" playsinline muted autoplay aria-hidden="true" tabindex="-1"></video>
<canvas class="hlx-canvas" aria-hidden="true"></canvas>
<div class="hlx-bar">
<button class="hlx-btn hlx-cam-btn" type="button" aria-pressed="false">
<span class="hlx-btn-ico" aria-hidden="true"></span><span class="hlx-btn-txt">Turn camera on</span>
</button>
<p class="hlx-privacy">No image ever leaves your device.</p>
</div>
<p class="hlx-status" role="status" aria-live="polite"></p>
<div class="hlx-label" aria-hidden="true">
<span>Lightning Hands</span>
<span class="hlx-hint">move the cursor · or turn the camera on</span>
</div>
</div>
</div>
One-time payment, no subscription — the code is yours forever
Customize
Options passed to the API or data-* attributes:
| Option / property | Default | Effect |
|---|---|---|
Scene size (CSS — .hlx-scene) |
100% wide, aspect-ratio: 16 / 10, 240 px minimum |
To fill a block, give the parent a height, then aspect-ratio: auto; height: 100%. Ghost hands measure 19% of the short side and never go below 34 px: in a frame under 180 px they stop shrinking and end up overlapping. |
Kiosk variant (HTML — .hlx-kiosk, data-hlx-start) |
not in the delivered HTML | Adds text on the left over a dark veil and a main button that starts the camera. Any element inside the scene carrying data-hlx-start plays that part. |
Texts (JS — TEXT, TEXT_EN) |
17 messages, French and English | All dynamic messages sit at the top of the script. data-hlx-lang="en" on the scene switches to TEXT_EN; fixed labels (button, privacy) are edited in the HTML. |
Number of hands (JS — MAX_HANDS) |
2 | At 1 there is no arc between hands any more: only the small arcs between fingers remain, 25% larger. Detection gets cheaper. |
Brightness and surges (JS — inten = 0.84, + 0.16) |
0.84 at rest, 1 during a 0.28 s surge | Lower the base for quieter arcs behind text. Do not shorten the 0.45 s gap between two surges: it is what keeps the effect under 3 changes per second. |
Colours (JS — strokeArc, SPR_TIP) |
arcs from blue rgba(40,120,255) to white, red fingertips |
The four colours in strokeArc go from halo to core. Additive blending needs a dark background: on a light one the arcs vanish. |
Smoothing (JS — SMOOTH, HOLD_MS) |
0.5 and 220 ms | A lower SMOOTH gives steadier hands that lag behind the gesture. HOLD_MS keeps a hand for 220 ms after it disappears, fading, so it does not flicker. |
Canvas sharpness (JS — DPR_MAX) |
1.5 | Pixel-density cap. At 2 the arcs look finer on a Retina screen, for a third more pixels to fill on every frame. |
MediaPipe version (JS — MP_VERSION) |
'1.0.1', pinned |
The module and the wasm folder must come from the same version. To depend on no CDN, host those files and the model yourself and change the four MP_… addresses. |
FAQ
script-src and connect-src. If a Permissions-Policy header blocks the camera, write camera=(self). Inside an iframe, add allow="camera". These four points are listed at the top of the script. A CSP that leaves odml.pa.googleapis.com out of connect-src blocks MediaPipe's usage record, and detection carries on..hlx-scene gets its own instance, demo and button; the detector is downloaded once for all of them. Only one camera stays open at a time: starting the second scene stops the first, measured with two copies of the code in Chromium and Firefox.