Air Drawing
A neon pen at the tip of your index finger: draw in the air in front of the webcam, raise two fingers to stop, grab a stroke with a pinch, wipe everything with a held fist, then download the drawing. Without a camera, the mouse or a finger draws while pressed.
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
It is the only effect in the family whose gesture leaves a mark that stays. With the index raised alone, the fingertip draws. The line is not a string of dots: a Catmull-Rom curve runs through the sampled positions (at least 2.5 px apart), thinning when the finger moves fast and thickening when it slows, like a real nib. It is painted twice, an additive glow underneath and an opaque core on top, which gives it its neon tube look.
The rest of the hand works as tools. Index and middle finger raised, or an open hand: the pen lifts and the ring follows the finger without drawing. A thumb-and-index pinch with the other fingers open grabs the nearest stroke (or else the last one) and moves it with the hand. A fist held for 0.6 s clears everything: strokes burst into particles that live 0.9 s and fade out. Pointing at a swatch for 0.5 s fills a ring around it and changes colour. Each gesture has to hold for 0.1 s before it counts, so a hesitating hand does not scrawl over the page.
Three buttons complete the hand: Undo (also Ctrl+Z, or Cmd+Z on a Mac), Clear, Download. The last one builds a PNG in the browser, the strokes over a midnight-blue background painted by the code (not your scene's CSS background), and saves it under a dated name; nothing is uploaded. Finished strokes are kept in two off-screen layers: only the line in progress is redrawn each frame, and everything follows the scene when it resizes.
With the camera off, you draw with the mouse or a finger by holding it down. If nobody draws, a drawn hand has already written "Hello" in cursive; it underlines it, picks pink, adds a heart, waits, wipes it with a fist and starts again. As soon as the visitor draws their first stroke, it steps away for good. The captures on this page show that mode, with the shipped code.
Accessibility
- What works from the keyboard: camera button, colour swatches (buttons with
aria-pressed, colour name spelled out), Undo, Clear and Download, in that order, with Enter or Space. Ctrl+Z undoes in the last scene used, except when focus is in a text field. Drawing itself needs a pointer or a hand: there is no keyboard drawing. - Messages: saving the image ("Image saved on your device") or having nothing to save ("Nothing to save yet") is announced in the
role="status"pill, like the camera messages. The canvas is hidden from assistive technology: a hand drawing has no text equivalent, so provide one if the content matters. - Reduced motion: the demo word, underline and heart are placed at once, the drawn hand stays still, the glow does not pulse, and Clear empties the scene in one go, with no particles or fade.
- Touch: inside the scene the finger draws, top to bottom included, so the page does not scroll when dragged there. Leave enough margin around the scene on mobile so people can scroll elsewhere. Checked with touch emulation.
- Light: no flash. Clearing is the liveliest moment: a few hundred coloured particles for under a second, then a fade.
Browser compatibility
Canvas 2D, with two off-screen layers for finished strokes; 66 KB of JavaScript and 11 KB of CSS unminified. Tested with Chromium 149, WebKit 26.5 and Firefox 151: two copies on a page stay independent, nothing is downloaded in the demo, animation stops off screen; Undo, Ctrl+Z, Clear and Download tried in Chromium and Firefox. Simulated camera (Chromium, Firefox): four files on first activation, and the demo "Hello" goes away when the camera starts. A test video let the detector find the hands; drawing, pen up, the pinch that moves a stroke, colour picking and fist clearing were confirmed by injecting hand positions. While detection runs, Google's library sends a short usage report to odml.pa.googleapis.com every minute: version number, processing times, never an image or a stroke. You can mention it in your privacy policy. Safari: camera not verified.
Minimum versions set by aspect-ratio. Without toBlob, the image goes through toDataURL. Camera refused, missing or busy, module unreachable: a message, and mouse or finger drawing carries on, existing strokes included. A scene without colour swatches draws in the default colour. Camera access goes through the browser's permission prompt and needs an https page; it stops if the scene scrolls out of view or the tab is hidden, and the strokes stay.
The code
HTML structure to paste into your page (the CSS + JS come with your purchase):
<div class="fx-0854-root">
<div class="adw-scene" data-adw-lang="en" role="region" aria-label="Air Drawing — your index fingertip draws a neon line. Mouse demo (hold to draw), camera on request (processed on your device only)">
<video class="adw-video" playsinline muted autoplay aria-hidden="true" tabindex="-1"></video>
<canvas class="adw-canvas" aria-hidden="true"></canvas>
<div class="adw-bar">
<button class="adw-btn adw-cam-btn" type="button" aria-pressed="false">
<span class="adw-btn-ico" aria-hidden="true"></span><span class="adw-btn-txt">Turn camera on</span>
</button>
<p class="adw-privacy">No image ever leaves your device.</p>
</div>
<p class="adw-status" role="status" aria-live="polite"></p>
<div class="adw-label" aria-hidden="true">
<span>Air Drawing</span>
<span class="adw-hint">hold the mouse button to draw · or turn the camera on and raise your index finger</span>
</div>
<div class="adw-tools">
<div class="adw-palette" role="group" aria-label="Line colour">
<button class="adw-swatch" type="button" data-adw-rgb="79,233,255" data-adw-name="cyan" style="--adw-c:#4fe9ff" aria-label="Cyan" title="Cyan" aria-pressed="true"></button>
<button class="adw-swatch" type="button" data-adw-rgb="255,92,214" data-adw-name="pink" style="--adw-c:#ff5cd6" aria-label="Pink" title="Pink" aria-pressed="false"></button>
<button class="adw-swatch" type="button" data-adw-rgb="176,255,84" data-adw-name="green" style="--adw-c:#b0ff54" aria-label="Green" title="Green" aria-pressed="false"></button>
<button class="adw-swatch" type="button" data-adw-rgb="255,176,64" data-adw-name="orange" style="--adw-c:#ffb040" aria-label="Orange" title="Orange" aria-pressed="false"></button>
<button class="adw-swatch" type="button" data-adw-rgb="184,150,255" data-adw-name="violet" style="--adw-c:#b896ff" aria-label="Violet" title="Violet" aria-pressed="false"></button>
</div>
<div class="adw-actions">
<button class="adw-btn adw-tool adw-undo" type="button" aria-label="Undo the last stroke (Ctrl+Z)" title="Undo the last stroke (Ctrl+Z)">
<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M6 3.5 2.5 7 6 10.5M2.5 7h7a4 4 0 0 1 0 8H8"/></svg><span class="adw-btn-txt">Undo</span>
</button>
<button class="adw-btn adw-tool adw-clear" type="button" aria-label="Clear everything" title="Clear everything">
<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M2.5 4.5h11M6 4.5V3h4v1.5M4 4.5l.7 9h6.6l.7-9"/></svg><span class="adw-btn-txt">Clear</span>
</button>
<button class="adw-btn adw-tool adw-save" type="button" aria-label="Download the drawing (PNG image, saved on your device)" title="Download the drawing (PNG)">
<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M8 2.5v8m0 0L4.8 7.3M8 10.5l3.2-3.2M2.5 12.5v1h11v-1"/></svg><span class="adw-btn-txt">Download</span>
</button>
</div>
</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 |
|---|---|---|
Colours (HTML — data-adw-rgb, data-adw-name on each swatch) |
cyan, pink, green, orange, violet | Add, remove or rename swatches; the first one is the starting colour. With no swatch at all, the line uses the default colour. |
Where the demo word goes (HTML — data-adw-box, data-adw-box-portrait) |
0.06,0.16,0.78,0.84 | Rectangle in scene fractions (left, top, right, bottom) where "Hello" is written, with a variant for scenes taller than wide. |
Buttons that start the camera (HTML — data-adw-start) |
none | Any button in the scene with this attribute switches the camera on, in addition to the bar button. |
Gesture holding times (JS — GEST_HOLD, FIST_HOLD, DWELL) |
0.1 s, 0.6 s, 0.5 s | Time before a gesture is adopted, length of the clearing fist, and time spent pointing at a swatch. Lengthen FIST_HOLD if drawings get wiped by accident. |
Line resolution (JS — PT_MIN) |
2.5 px | Minimum gap between two recorded points. Larger gives a smoother, lighter line; smaller keeps the detail. |
Clearing (JS — FADE_T, PART_T, MAX_PARTS) |
0.45 s, 0.9 s, 420 | Fade duration, particle life and maximum particle count. |
Download file name and messages (JS — TEXT_FX, TEXT_FX_EN) |
dessin-dans-l-air, air-drawing | Start of the PNG name (today's date is appended) and the texts shown after saving. |
FAQ
scene.adwBase.effect.strokes: an array of objects with their points (pts, in scene pixels) and colour (rgb). You can store them as JSON to redraw later, or read the canvas as an image. The code sends them nowhere: that is up to your page, if you want it.touch-action: none): otherwise every vertical stroke would scroll the page instead of drawing. On mobile, keep the scene smaller than the screen and leave margin around it for scrolling.