AR-Drawing

A lightweight AR drawing and tracing projector for your phone. Point the camera at your paper, load a sketch, dial in opacity and size, and trace. Runs entirely on the device, installs as a PWA, and works offline.

Language
JavaScript
Stars
0
Last updated

From the README

Tracer

A lightweight AR drawing and tracing projector for your phone. Point the camera at your paper, load a sketch, dial in opacity and size, and trace. Runs entirely on the device, installs as a PWA, and works offline.

No build step. Plain HTML, CSS and JavaScript.

Empty state Sketch loaded Overlay locked with registration marks Focus mode with grid

Features

  • Live rear camera feed that covers the screen, with a one-tap switch to the front camera
  • Load any image from your phone; it floats centered and semi-transparent over the video
  • Opacity (0–100%), size (10–100% of the screen) and rotation sliders
  • Drag to move, pinch to resize, twist to rotate. Gestures land on the camera surface, never on the image
  • Lock the overlay so accidental touches don't move it
  • Mirror, invert colours, 8×8 grid, torch (when the camera supports it)
  • Focus mode hides all chrome for a clean view
  • Screen stays awake while the app is open
  • Your last sketch and settings are restored when you reopen the app
  • Installable, offline-capable, no double-tap zoom or rubber-band scroll

Run locally

Camera access needs a secure context. localhost counts.

npx serve .
# or
python -m http.server 8000

Opening it from a phone over plain HTTP will not give camera access. For quick testing on a real device, deploy to GitHub Pages (below) or tunnel with npx localtunnel --port 8000.

Deploy to GitHub Pages

  1. Create a new repository on GitHub (any name, e.g. tracer).

  2. Push this folder:

    git init
    git add .
    git commit -m "Tracer PWA"
    git branch -M main
    git remote add origin https://github.com/<you>/<repo>.git
    git push -u origin main
  3. On GitHub: Settings → Pages → Build and deployment → Source: Deploy from a branch, branch main, folder / (root). Save.

  4. After a minute the app is live at https://<you>.github.io/<repo>/.

All paths are relative, so it works from a project sub-path with no config changes. GitHub Pages serves over HTTPS, which the camera and the service worker require.

Install on your phone
  • Android / Chrome: open the URL, tap the menu, Add to Home screen (or accept the install banner).
  • iOS / Safari: open the URL, tap Share → Add to Home Screen.
Updating

Edit files, bump VERSION in sw.js (e.g. tracer-v1.0.1), commit and push. Installed apps pick up the new version the next time they're opened.

Regenerate icons

The PNG icons are produced from the same design as icons/icon.svg:

pip install pillow
python tools/make-icons.py

Keyboard (desktop)

Arrow keys nudge (Shift for 10px), r reset, l lock, g grid, f focus mode, Esc exit focus, mouse wheel resizes. Drop or paste an image anywhere.

Browser notes

  • The rear camera is requested first with facingMode: environment, falling back to any camera on laptops.
  • The torch button only appears when the active camera track reports torch in its capabilities (Android Chrome, rear camera).
  • iOS Safari does not support the Screen Wake Lock API; the screen may dim according to system settings.