examples/. Each is a Vite project with the same scripts: dev starts the dev server that Drawdy’s development mode hot-reloads from, build packs dist/<driver-id>.drawdyx (dots in the id become dashes, so drawdy.hello builds dist/drawdy-hello.drawdyx), and typecheck runs tsc.
From the repo root:
Drawdy Hello
drawdy-hello
drawdy.hello: says hello to the drawdy main loop. One source file.subscription:scene:elements-added, command:camera:get-info, and command:camera:fly-to-elements.
Bomb
drawdy-bomb
drawdy.bomb: drag the bomb over your elements and drop to blow them up.subscription:dom:drag rather than native browser drag, and local animation for the blast. Shows:
- A scoped
subscription:dom:drag: armed on the action button (command:dom:create-action-button), then re-scoped to the ring so the gesture keeps flowing while you drag it around. - A cursor-following overlay:
command:dom:create-floating-elementwithasPopover: false, moved every tick withcommand:dom:move-floating-element, torn down withcommand:dom:remove-floating-elementandcommand:subscription:remove. - Area hit-testing on drop:
command:camera:get-info,command:scene:query-rect,command:scene:element-rects. - Local animation:
command:scene:update-drawdy-elementswith aLocalAnimationthat flings each element radially and spins it, thencommand:scene:remove-drawdy-elementsonce the blast finishes. - Also
command:tools:set-active.
Background Remover
drawdy-background-remover
drawdy.background-remover: right-click a selected image and remove its background, entirely on-device.u2netp for speed, silueta for quality), pulled from a CORS-enabled mirror and verified by SHA-256 before use. Shows:
- Context menus with children:
command:context-menu:add,subscription:context-menu:clicked. - Reading the selection:
command:scene:get-current-selected-drawdy-elements,command:scene:get-drawdy-elements. - Image pixels in and out:
command:scene:get-image-source, thencommand:scene:add-drawdy-elementswith a blob-sourcedimageplaced beside the original. - A status toast built from
command:dom:create-floating-element/command:dom:remove-floating-elementandcommand:dom:window-size. - Loading a WebAssembly runtime in the worker with
importScripts, decoding withcreateImageBitmap+OffscreenCanvas, and a pure, unit-tested pre/post-processing pipeline undersrc/segment.ts:pnpm test.
Math Symbols
drawdy-math-symbols
drawdy.math-symbols: drag Greek letters, operators, and math notation straight onto the canvas.- A webview:
command:webview:create,command:webview:post-message,subscription:webview:message, andacquireDrawdyApi()from the webview API inside it. - An action button:
command:dom:create-action-button,subscription:dom:element-clicked,command:dom:element-rect. - Preview elements during drag and drop:
command:scene:create-drawdy-preview-elements,command:scene:delete-drawdy-preview-elements, thencommand:scene:add-drawdy-elements. - Text editing:
subscription:scene:text-edit,command:scene:update-text-edit. - Also
subscription:dom:theme-changed,subscription:keyboard:control-keys,command:scene:query-tool-style-state,command:camera:screen-to-canvas, andcommand:camera:get-viewport-rect.
Physics Engine
drawdy-physics-engine
drawdy.physics-engine: simulate selected elements as 2D rigid bodies: gravity, collisions, and impulse response.- Context menus:
command:context-menu:add,command:context-menu:remove,subscription:context-menu:clicked. - Reading the selection:
command:scene:get-current-selected-drawdy-elements,command:scene:get-drawdy-elements. - The preview-transform lifecycle:
command:scene:begin-preview,command:scene:preview-transforms,command:scene:end-preview, pluscommand:scene:update-drawdy-elements. - Scene events
elements-added,elements-updated,elements-removed,elements-replaced, andsubscription:camera:moved-rapid. - A physics engine under
src/engine/(broadphase, narrowphase, impulses, frame clock) with Jest tests:pnpm --filter drawdy-physics-engine test.
Presentation
drawdy-presentation
drawdy.presentation: turn a board into slides — a React webview picker, per-slide framing, and a fullscreen presenter.rollup.config.mjs). Shows:
- A React webview:
command:webview:create,command:webview:hide,command:webview:post-message,subscription:webview:message, andacquireDrawdyApi()from the webview API inside it. - DOM surfaces: a floating slide picker via
command:dom:create-floating-elementandcommand:dom:remove-floating-element,command:dom:create-action-button,command:dom:element-rect,command:dom:window-size, and fullscreen presenting withcommand:dom:enter-fullscreen,command:dom:exit-fullscreen, andsubscription:dom:fullscreen-changed. - Context menus:
command:context-menu:add,subscription:context-menu:clicked. - Scene reads and writes:
command:scene:get-current-selected-drawdy-elements,command:scene:get-drawdy-elements,command:scene:add-drawdy-elements,command:scene:update-drawdy-elements,command:scene:query-combined-rect,command:scene:element-rects, and slide thumbnails viacommand:scene:capture-screenshot. - Camera
command:camera:fly-to-elementsand toolscommand:tools:get-active,command:tools:set-active. - Scene events
elements-added,elements-updated,elements-removed,elements-replaced, plussubscription:scene:activityandsubscription:dom:theme-changed; unsubscribes withcommand:subscription:remove.