Particle Sphere
A 4,200-point sphere settles on your palm: the number of raised fingers picks its colour, the gap between two hands its size, a wide-open hand makes it burst.
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 sphere is a globe of dots laid out on 48 parallels, drawn with WebGL in an off-screen canvas and then copied onto the scene's canvas. The number of dots shown follows the radius: 500 for a small sphere, 4,200 above 100 px. It spins slowly on itself, and faster when the hand moves; dots on the far side are darker, which gives it depth.
The effect reads two values from the hand. With a single hand it counts raised fingers: zero to five, six colours (violet, mauve, pink, orange, warm white, gold), confirmed after 0.16 s so they do not flicker; the fingertips that count light up. With two hands the sphere turns cyan, sits between the palms, and its radius is 38% of the gap between them.
Hand wide open, fingers spread, for 0.08 s: the sphere bursts, its dots drift and curve back, all within 2.45 s and at most once every 2.4 s. A click or a tap in the scene triggers the same burst; on the webcam, bringing both hands together does too.
None of this needs a camera to begin with. The scene starts as a demo: with the cursor, two ghost hands frame the sphere, whose size follows the distance between the pointer and the opposite hand; without a cursor, a 14 s script goes through two hands, one hand with 2, 3 and 4 fingers, then the burst. The three examples on this page run that way. The webcam only switches on when its button is clicked; hands are then located by MediaPipe inside the browser, and the video stream is passed to no server (the FAQ details the one technical report that does go out).
Accessibility
- Keyboard: only the camera button can be operated from the keyboard (Tab, then Enter or Space). Bursting on click has no keyboard equivalent in the delivered code; if your page relies on it, add a button that calls
burst(), as the third example does. - Reduced motion: the sphere no longer spins, breathes or bursts (click and gesture are ignored), and the automatic script is replaced by a still two-hand pose. It still follows the cursor. Measured: two captures 0.8 s apart are pixel-identical.
- Touch: a tap bursts the sphere; a horizontal drag moves the hand, a vertical drag scrolls the page. Measured with touch emulation, not on a phone.
- Screen readers: colour and size are not stated anywhere as text. If they carry information (a choice, a setting), write it in your page, as the fact sheet and the gauge in the examples do. Camera messages are announced through the
role="status"pill. - Light: a scattered sphere is darker than at rest, never brighter, and the 2.4 s delay between two bursts rules out any flicker.
Browser compatibility
WebGL 1 for the dots, 2D canvas for the halo and the hands; 46 KB of unminified JavaScript. Demo tried with software rendering under Chromium 149, Firefox 151, WebKit 26.5: two independent spheres on one page, a click on one does not reach the other, zero requests. Camera measured with a fake stream in Chromium and Firefox; finger reading was checked by injecting hand landmarks into the code, not with a real filmed hand. Safari: camera not verified.
Without WebGL the dots are drawn on a 2D canvas: 200 to 900 small squares, same rotation, simplified burst. If the WebGL context is lost it is recreated up to three times before that fallback. Webcam refused or not found: the pill explains it and the sphere stays cursor-driven. The browser asks for permission on the first click, and only on an https page; the webcam switches itself off as soon as the sphere leaves the screen or the tab goes to the background.
The code
HTML structure to paste into your page (the CSS + JS come with your purchase):
<div class="fx-0845-root">
<div class="psx-scene" data-psx-lang="en" role="region" aria-label="Particle Sphere — a sphere of light settles on your hand and follows your gestures. Cursor demo, camera on request (processed on your device only)">
<video class="psx-video" playsinline muted autoplay aria-hidden="true" tabindex="-1"></video>
<canvas class="psx-canvas" aria-hidden="true"></canvas>
<div class="psx-bar">
<button class="psx-btn psx-cam-btn" type="button" aria-pressed="false">
<span class="psx-btn-ico" aria-hidden="true"></span><span class="psx-btn-txt">Turn camera on</span>
</button>
<p class="psx-privacy">No image ever leaves your device.</p>
</div>
<p class="psx-status" role="status" aria-live="polite"></p>
<div class="psx-label" aria-hidden="true">
<span>Particle Sphere</span>
<span class="psx-hint">move the cursor · click to burst it · 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 |
|---|---|---|
Finger colours (JS — PALETTE) |
6 RGB colours, 0 to 5 fingers | One row per finger count. Two neighbouring counts that are too close (0 and 1 by default: violet and mauve) are hard to tell apart: spread the hues if the choice matters. |
Two-hand colour (JS — CYAN) |
[95, 230, 255] |
Tint of the large sphere between the palms. The halo behind the sphere takes the same colour. |
Number of dots (JS — N_POINTS) |
4,200 | Cap on dots drawn. 2,000 lightens rendering on a small device; the sphere stays readable since small spheres already show only 500. |
Delay between two bursts (JS — BURST_COOLDOWN) |
2.4 s | Do not go below the 2.45 s of EXPLODE_END without shortening the shader animation too: a burst cannot start during the previous one. |
“Wide-open hand” threshold (JS — WIDE_RATIO) |
1.6 | Ratio between the spread of the fingertips and that of their bases. Lower, the sphere bursts as soon as the hand opens; higher, fingers really have to be spread. |
Spin speed (JS — s.ay += dt * (0.35 + …)) |
0.35 radian per second, one turn in 18 s | Base rotation, to which the hand's speed is added. At 0 the sphere only turns while being moved. |
Scene background (CSS — background of .psx-scene) |
night-violet radial gradient | Dots add their light to the background: keep it dark. On a light background the sphere fades until it disappears. |
Kiosk variant (HTML — .psx-kiosk, data-psx-start) |
not included in the delivered HTML | The CSS contains a welcome screen ready to fill in: .psx-scrim veil, .psx-kiosk-content block, .psx-cta button. The button starts the camera if it carries data-psx-start. |
FAQ
scene.psxBase.effect.s gives count (raised fingers), mode (1 or 2 hands), R (radius) and exp (non-null during an explosion). Read it at regular intervals, as the three examples do. effect.burst() triggers the burst from your code.