[01] Overview
Sketch Canvas is a high-performance, 100% client-side digital whiteboard, vector diagramming, and media annotation studio. Built from the ground up to operate without server dependencies or external databases, Sketch Canvas pairs a GPU-accelerated infinite 2D camera engine with a dual-layer hybrid architecture: an in-memory 2D HTML5 Canvas rendering velocity-interpolated Bézier strokes at 2x Retina resolution, and an interactive DOM/SVG vector layer supporting corners-based affine polygon transformations, pastel sticky notes, rich typography, and native video playback with scrubbing. Combined with W3C Document Picture-in-Picture (PiP), Sketch Canvas can detach into an OS-level always-on-top window for annotating over desktop applications.
[02] Under The Hood & Browser Engine Architecture
Sketch Canvas coordinates several specialized client-side subsystems to deliver frictionless 60 FPS drawing, continuous zooming, and seamless multitasking:
Infinite 2D Camera Transform & Focal Zoom Engine
Renders the canvas plane using GPU-accelerated `translate3d(panX, panY, 0) scale(zoom)` with `transform-origin: 0 0`. Computes world-space cursor anchors before scaling to provide true 360-degree focal zooming from 2% (0.02) to 500% (5.0) without viewport clipping.
Dual-Layer Hybrid Model (Raster Canvas + DOM Vector)
Separates high-frequency raster brush strokes on an in-memory `<canvas>` buffer from structured DOM/SVG elements (shapes, arrows, sticky notes, text, media), giving users instant stroke responsiveness while retaining full inspectability and editability for diagram objects.
Velocity & Pressure-Sensitive Bézier Interpolation
Smooths rapid cursor and stylus movements using midpoint quadratic Bézier curves (`quadraticCurveTo`). Calculates instantaneous stroke velocity to modulate line widths between 35% and 160%, with stochastic particle scatter for textured graphite pencils and multiply-blend highlighters.
Corners-Based Polygon Transformation Model
Represents every selectable object as a 4-point world-space polygon `[{x,y}, {x,y}, {x,y}, {x,y}]`. Rotations spin around the polygon centroid, while resize handles scale against opposite AABB anchors independently in X and Y to produce authentic affine shearing (parallelogram effects).
Document Picture-in-Picture (PiP) Architecture
Harnesses `window.documentPictureInPicture.requestWindow()` to detach the whiteboard canvas, toolbars, and active drawing state into a native OS always-on-top floating window, re-injecting scoped styles and keyboard event listeners dynamically.
Tight Auto-Crop Composite 2D PNG Serializer
Flattens raster strokes, transformed SVG polygons, styled typography, sticky notes, and media poster frames onto an offscreen canvas cropped tightly around content bounds with 48px padding at high DPI (2x Retina scale).
[04] 2. Multi-Mode Brush Physics & Velocity Dynamics
[05] 3. Corners-Based Polygon Transforms & Affine Shearing
[06] 4. Vector Diagramming, Pastel Sticky Notes & Media
[07] 5. Document Picture-in-Picture (PiP) Floating Architecture
[08] 6. Composite High-Res PNG Export & 100% Client Privacy
[SPEC] Technical Specifications & Limits
| Parameter / Property | Specification / Value |
|---|---|
| Rendering Model | Hybrid (2D Raster Canvas + DOM/SVG Vector Layer) |
| Camera Zoom Range | 2% (0.02) to 500% (5.0) |
| Brush Engines | Fountain Pen, Marker, Pencil, Highlighter, Eraser |
| Transformation Geometry | Corners-Based 4-Point Polygon Matrix |
| Multitasking PiP | W3C Document Picture-in-Picture API |
| Export Resolution | High-DPI (2x Retina devicePixelRatio) |
| Storage & Persistence | 100% Client-Side LocalStorage |
| Privacy & Network | 0 Server Requests, 0 Telemetry Uploads |
[KEYS] Keyboard Shortcuts
[CODE] Developer Integration & Code Examples
import { exportCanvasAsPNG } from "./utils/canvasExport";
// Automatically calculates tight content bounds and downloads PNG
await exportCanvasAsPNG({
canvas: document.getElementById("drawCanvas"),
objLayer: document.getElementById("objLayer"),
theme: "paper", // "paper" (#f6f3ea) or "dark" (#17171b)
stateRef: { current: { hasDrawn: true, drawMinX: 100, drawMinY: 100, drawMaxX: 800, drawMaxY: 600 } }
});if ("documentPictureInPicture" in window) {
const pipWin = await window.documentPictureInPicture.requestWindow({
width: 960,
height: 600,
});
// Re-inject stylesheet rules for consistent rendering
Array.from(document.styleSheets).forEach((sheet) => {
try {
const style = pipWin.document.createElement("style");
style.textContent = Array.from(sheet.cssRules).map(r => r.cssText).join("");
pipWin.document.head.appendChild(style);
} catch (e) {
// Cross-origin stylesheet fallback
const link = pipWin.document.createElement("link");
link.rel = "stylesheet";
link.href = sheet.href;
pipWin.document.head.appendChild(link);
}
});
// Mount container into floating window
pipWin.document.body.appendChild(document.getElementById("app"));
}[FAQ] Frequently Asked Questions
Try Sketch Canvas Online Now
Test all features in your browser with zero installations, zero server uploads, and 100% free offline capabilities.
Open Interactive Tool