The viral Time Warp Scan filter, running 100% in your browser with TensorFlow.js.
No app. No sign-up. No uploads. Just your webcam and a scan line that freezes time.
The Time Warp Scan is the effect that blew up on TikTok. A line sweeps across the camera and freezes every pixel it passes. Move while the line goes by and you can stretch your face, clone yourself, or pull off illusions that look impossible.
TimeWarpScan.me recreates that filter on the open web:
- 🎥 Live webcam scanning, top-down or left-to-right
- 🎛️ Controls: scan speed ("brakes"), scan line size, delayed start, mirror, color/grayscale and looping
- 💾 Download your result as a PNG image or a recorded video
- 🔒 Private by design: every frame is processed on your device with WebGL. Nothing is uploaded or stored.
- 🆓 Free and open source (MIT)
👉 Try it now at timewarpscan.me
Each webcam frame is turned into a tensor with TensorFlow.js, and the scan builds the final image one strip at a time:
tf.browser.fromPixels()grabs the current video frame on the GPU.- The frame is resized to the canvas and optionally mirrored (
tf.reverse). - A thin slice at the scan line's position is cut out with
tf.slice. - That slice is
tf.concat-ed onto the slices from earlier frames. tf.browser.toPixels()paints the slice to a canvas, and aMediaRecordercaptures the whole composite as video.
Each row (or column) of the result comes from a slightly different moment, which is what makes the "time warp" happen. Everything runs inside tf.tidy() and tensors are disposed as they go, so memory stays flat no matter how many scans you run.
The core logic lives in timewarpscanme/src/Scancam.jsx.
The previous/ folder has the plain-HTML prototypes this project grew from. Each one adds a single feature, which makes it a good way to learn the technique:
| Step | File | Adds |
|---|---|---|
| 1 | 1simplest.html |
The smallest working time warp scan |
| 2 | 2efficient.html |
Draws slices directly instead of re-rendering the whole tensor |
| 3 | 3loops.html |
Continuous looping scans |
| 4 | 4mirror.html |
Mirrored (selfie) mode |
| 5 | 5delay.html |
Delayed start so you can get in position |
| 6 | 6workingvideo.html |
Records the scan to video |
Want to go deeper? The techniques used here are covered in the book Learning TensorFlow.js (O'Reilly) by Gant Laborde.
You'll need Node.js 18+ and Yarn.
git clone https://github.com/GantMan/timewarp.git
cd timewarp/timewarpscanme
yarn
yarn start # dev server on http://localhost:3000| Command | What it does |
|---|---|
yarn start |
Start the Vite dev server with hot reload |
yarn build |
Production build into timewarpscanme/build |
yarn preview |
Serve the production build locally |
Webcams only work on
localhostor HTTPS, and your browser will ask for camera permission.
The site is hosted on AWS Amplify Hosting, with DNS at name.com. Every push to main triggers a build:
amplify.yml: build settings (Amazon Linux 2023 image, Node 20,yarn buildintimewarpscanme, publishestimewarpscanme/build)customHttp.yml: response headers (long-term caching for fingerprinted assets, security headers, camera permissions policy)
timewarp/
├── amplify.yml # Amplify build spec
├── customHttp.yml # Amplify response headers
├── previous/ # Step-by-step HTML prototypes
└── timewarpscanme/ # The React app
├── index.html # SEO meta tags, Open Graph, JSON-LD
├── public/ # Static assets, sitemap, robots.txt, manifest
└── src/
├── App.jsx # Intro ↔ scanner switch (scanner is lazy-loaded)
├── Intro.jsx # Landing page
├── Warper.jsx # Scanner controls (Material UI)
└── Scancam.jsx # Webcam + TensorFlow.js time warp engine
Issues and PRs are welcome! Good places to start:
- 🦊 Firefox support. The scanner currently has trouble in Firefox. If you can track down why, you're a hero.
- 📱 Mobile layout for the scanner screen
- 🎨 New scan modes (diagonal, radial, …)
Created by Gant Laborde (@GantLaborde) of Infinite Red, the React Native and AI consultancy.
If you made something fun with it, share it and tag @GantLaborde! And if you like the project, a ⭐ helps other people find it.
MIT © Gant Laborde