Canvas 2D · Case study
The page
is the screenshot.
Capture is a screenshot and annotation prototype whose demo captures itself. The live preview is drawn in Canvas 2D. The shutter copies its actual pixels at device resolution, freezes them in place, and turns the same stage into an editor. No extension, no upload, no second app.
- Role
- Product design and frontend
- Stack
- TypeScript, Vite, Canvas 2D
- Surface
- One page, no framework
- Status
- v0.1, November 2026
The problem
Every screenshot tool starts by leaving the page.
The OS shortcut opens a markup window. The extension asks for permission to read every tab. The upload service wants the image on its server before it can be annotated. The page is always the input, never the tool.
That split is familiar, and it costs three things. The pixels are often captured at display resolution. The markup happens in another context. And the file usually takes a detour through a second app or someone else’s storage.
Capture starts from a different premise. The page already has a renderer, pixels, a clipboard, and a download path. It can do the whole job itself.
- OS capture. Fast and universal, but the edit happens in a separate window, and the result is a file you now have to manage.
- A browser extension. One click and the viewport is yours, at the cost of a permission surface and, usually, a separate editor.
- Upload and annotate. Good for sharing and collaboration, but the image leaves the machine before the first arrow is drawn.
Each one treats the page as input. Capture treats the page as the camera.
A different place to do the work.
The comparison is not about features. It is about where the pixels live and who holds them.
| Criterion | Outside the page | Capture |
|---|---|---|
| Where it runs | An OS tool, an extension, or a separate app. | In the page, on the same stage as the preview. |
| What it captures | The viewport, a window, or a tab, usually at display resolution. | The live canvas backing store, up to 2.5× the CSS size. |
| The edit | A second editor, sometimes after a save or an upload. | The same stage, immediately after the freeze. |
| The data path | A file, a clipboard, or a server. | Clipboard or local download. Nothing is sent. |
| Setup | An install or a permission prompt. | Open the page. |
The idea
A demo that can see itself.
The subject is Northstar, a fictional analytics app drawn entirely with Canvas 2D: cards, charts, type, the pulsing endpoint, all of it.
The demo is not a screenshot of an app. It is a live drawing, repainted roughly thirty times a second. That matters because the shutter copies the actual backing store. The capture is not a re-render or a reconstruction. It is the same pixels the browser just painted.
Then the stage changes jobs. The live layer fades, the frozen bitmap takes over, and the toolbar appears on the same rectangle. There is no mode switch to another screen, no file picker, no upload. The page is the subject, the camera, and the editor.
The premise
The demo is the subject. The capture is real.
This is the part that is hard to fake in a mockup. The tool is not describing a capture workflow. It is running one.
The app is deliberately small: four TypeScript modules, one HTML file, one stylesheet, no runtime framework. The interesting part is not the amount of code. It is where the pixels come from.
The walkthrough
One shutter press, three minutes.
The film runs 3:09. Its product footage is the real prototype, captured at 2×. It covers the freeze, the selection, the three marks, the export, the audio, the clock, the zero-asset build, and the quiet defaults.
docs/explainer/.
A 60-second route
If you would rather try it than watch it, this is the shortest path through the demo.
-
0:00 to 0:08
Open on the live preview.
- Do this
- Load the demo at 1440 × 900. Leave the pointer still.
- Notice
- Northstar breathes. The endpoint pulses, the LIVE dot blinks, and a scan crosses the chart.
-
0:08 to 0:16
Press the shutter.
- Do this
- Click the shutter or press C.
- Notice
- The flash fires, the live loop stops, and the frozen bitmap takes over. The prompt asks for a selection.
-
0:16 to 0:28
Select the chart and the notes.
- Do this
- Drag from the top of the signal chart to the bottom of the review notes.
- Notice
- Everything outside dims. Eight handles appear. The tag reports 1022 × 393.
-
0:28 to 0:42
Add three marks.
- Do this
- Arrow to the peak. Box the note. Blur the email line.
- Notice
- The arrow gets an ice stroke and a dark halo. The box frames the note. The email becomes a mosaic built from the pixels underneath.
-
0:42 to 0:50
Copy, then paste.
- Do this
- Click Copy and paste into any editor. Download also works.
- Notice
- The clipboard gets the clean crop at source resolution. The veil, handles, and toolbar are not in the file.
-
0:50 to 1:00
Exit and repeat.
- Do this
- Press Esc or Exit. Capture again.
- Notice
- The live preview resumes. The mute setting survives a reload. The frozen image never left the tab.
Read the transcript
-
0:01
The page is the screenshot
This page has a screenshot tool inside it. On the right is a live app, drawn on a canvas. Press the shutter, and the drawing freezes into a picture. Then you mark it up without leaving the tab.
-
0:17
The freeze
The preview is not an image. It is a canvas, painted fresh thirty times a second. The shutter copies its pixels at device resolution into a second canvas. The backing bitmap is capped at two and a half times the CSS size. The live layer fades, and the copy takes its place.
-
0:38
The selection
The frozen canvas becomes an editor. Drag a rectangle, and everything outside it dims. Eight handles resize it, and a tag reports the pixel size. The rectangle is stored as fractions, so it survives a resize.
-
0:55
Three marks
Three tools mark up the capture. Arrow points. Box frames. Blur redacts with a mosaic built from the frozen pixels underneath. Each mark is stored as geometry, not baked into the image. It redraws cleanly at any size.
-
1:15
The clean copy
Copy and Download do not read the screen. They build a clean canvas from the frozen bitmap. Annotations go on top, and the selection becomes the crop. The veil, the handles, and the toolbar are left behind. What you get is a PNG at native resolution.
-
1:37
Made from scratch
The shutter has a sound, but there is no audio file. It is filtered noise, a low thump, and a click. The copy chime is three sine notes. A soft error tone plays if the clipboard refuses. The audio engine starts inside your click, so nothing autoplays.
-
2:00
The clock
The preview breathes at about thirty frames a second. The endpoint pulses, the LIVE dot blinks, and a scan crosses the chart. Hide the tab, or scroll away, and the loop stops. Freeze the image, and the clock stops with it.
-
2:17
Nothing to download
The preview, the icons, and the sounds are all code. No image files. No audio files. No UI library. Only the fonts come from outside. The app is drawn, not screenshotted. So the demo can capture itself with no server in the loop.
-
2:38
The quiet defaults
The capture still works when the motion stops. Reduced motion removes the flash, the shake, and the entrances. The freeze becomes a fade, and every tool still works. Keyboard users get C, V, A, R, B, and Escape. The layout holds on a phone.
-
2:54
The page is the screenshot
A page that can see itself. A screenshot you never have to leave. The pixels stay in the tab. The page is the screenshot.
The film has no burned-in captions. This transcript carries the narration.
How it works
The freeze is the architecture.
There is no server, no scene graph, and no second copy of the interface. Four moves carry the whole prototype.
-
The preview is code.
PreviewRenderer paints Northstar with Canvas 2D. It targets roughly 30 fps, pauses when the tab is hidden or the station leaves the viewport, and renders a static frame under reduced motion.
-
The shutter copies the backing store.
startCapture() refreshes the preview, stops the loop, and passes the live canvas to the editor. The editor copies it into an offscreen canvas at the full backing-store size. No DOM is rasterized and no pixels are re-rendered.
-
Selection and marks are fractions.
The rectangle and every mark are stored in normalized 0 to 1 coordinates. The display canvas composites the frozen image, a dimming veil, the bright cutout, the marks, and the selection chrome. Resize the stage and the geometry still lines up.
-
Export starts from the source.
buildExportCanvas() paints the frozen bitmap and the marks into a clean canvas at native resolution, crops to the selection if there is one, and returns it. Copy and Download encode that canvas. The screen composition is never the source.
The copy and the export
// Copy the live backing store into the frozen bitmap.
beginCapture(source: HTMLCanvasElement) {
this.frozen.width = source.width;
this.frozen.height = source.height;
this.frozenCtx.drawImage(source, 0, 0);
this.captureScale = this.frozen.width / this.stage.clientWidth;
}
// Paint the source and the marks, then crop to the selection.
const png = editor.buildExportCanvas();
The stage chrome reports the backing-store size and the effective DPR. The frozen image stays intact while the live layer is hidden, which is why the editor can survive a resize without recapturing.
Four states, one stage. The contact sheet is made from real captures at 2×, not mockups.
The marks
Three marks, drawn from the pixels underneath.
Arrow, box, and pixel blur. Each one is geometry, not a baked-in edit, so it redraws at any size and in the export.
The arrow and the box are strokes with a dark halo under an ice line, so they read over bright and dark captures. The blur is not a CSS filter over the live app. It downsamples the selected region of the frozen bitmap into a small grid, then scales it back with smoothing off. The mosaic can only reveal pixels that are already in the capture.
Because the marks live in normalized space, they survive a resize and they scale to the source bitmap at export. The display composition and the file composition share the same geometry.
What each mark is made of.
- Arrow
- 2.4px ice stroke over a 5.4px dark halo, round caps
- Box
- 2.1px stroke with a 5.5 percent fill and a 2.5px radius
- Blur
- 2 to 90 cells per side sampled from the frozen bitmap, not the screen
Performance
Nothing moves until something changes.
The preview is an ambient loop, not a game. It runs at about 30 fps, stops when it is not visible, and stops again when the shutter fires.
- Backing-store cap
- 2.5×CSS size
- Preview
- ~30 fpsambient loop
- While captured
- 0render loops
- Mark tools
- 3arrow, box, blur
- Resize handles
- 8one selection
- Bytes uploaded
- 0clipboard or file
During a capture the loop stops before the copy, so the frozen frame and the live frame cannot disagree. The export is a synchronous composite over one bitmap. There is no network request in the path.
The film’s clock chapter follows the same rule: one requestAnimationFrame pulse feeds the endpoint, the LIVE dot, and the chart scan. Hide the tab or scroll the station away and the pulse stops. Freeze the image and the clock stops with it.
The numbers here are design constants and budgets from the build, not a published benchmark. A frame trace on a mid-range laptop is still to come. The target is a steady 30 fps preview and a capture that finishes inside one interaction, with no long task over 50 ms.
Accessibility
Every control is a real control.
The canvas is the picture. The interface around it is ordinary HTML, and the keyboard path is not an afterthought.
- Buttons, not divs. The shutter, toolbar, Copy, Download, Reset, and Exit are buttons with names. The toolbar takes ArrowLeft, ArrowRight, Home, and End. Focus moves to the snapshot after a capture.
- The shortcuts have equivalents. C captures. V, A, R, and B choose Select, Arrow, Box, and Blur. Esc exits. Every key has a visible control.
- The live region narrates. Captures, selection sizes, marks, clipboard results, and exits are announced. The preview canvas has a role and a name, and the snapshot is labeled and focusable.
- Motion is optional. Reduced motion removes the flash, the stage kick, and the entrance animations. Every tool still works, and the freeze becomes a fade.
- Sound waits for intent. The shutter and chime are synthesized with Web Audio inside a user gesture. Mute is remembered. Nothing autoplays.
- The phone layout holds. At 390 × 844 the stage stacks, the toolbar becomes icon-only, and touch dragging still works. Every tool is still reachable.
Every shortcut has a visible control in the toolbar or the station.
Limitations
What this does not claim.
A prototype is more convincing when it says where the edges are. These are the current ones.
- It captures its own canvas, not the full page or the operating system. That limit is the reason the demo is honest and the reason it is not a general screenshot tool yet.
- There is no per-mark undo. Reset discards the whole capture.
- Text callouts, movable annotations, and color choices are not implemented.
- Resizing during a capture stretches the frozen bitmap to the new stage aspect. The geometry survives; the pixels do not.
- Copy needs the Async Clipboard API and a secure context. When the clipboard blocks an image write, Copy downloads the PNG instead and says so.
-
There is no automated test suite yet.
npm run buildruns the TypeScript check. - The film is finished. The product’s in-page guided tour is not.
What is next
The next version should close the distance to a real tool.
The prototype has proven the interaction. The remaining work is resilience, range, and evidence.
-
Undo and selectable marks
A per-mark history, with the ability to move or delete one mark without resetting the capture.
-
Text and color
Short callouts and a small palette, without turning the toolbar into a design app.
-
A full-page path
Capture a taller surface than the stage canvas, then keep the same normalized editor. This is a different compositor, not a CSS tweak.
-
A real share sheet
The Download link is a placeholder today. Replace it with a desktop handoff or a save flow that matches the local promise.
-
A test suite
Cover normalized geometry, crop bounds, export size, keyboard behavior, and the clipboard fallback.
-
A frame trace
Measure paint counts and frame pacing on a mid-range laptop, then publish the numbers beside the current budgets.