Canvas recorder#43
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR rewrites how the ASCII art is rendered and exported, moving from DOM/HTML rendering to a
<canvas>-based pipeline, and swaps out the video export stack. Exports are now dramatically faster, especially longer animations.Core change: DOM → Canvas rendering
<pre>element with<span>s. It now draws directly to a<canvas>(#ascii-canvas).app/lib/core/canvas-renderer.tsreplaces the deletedtext-renderer.ts. It paints cells to a 2D context, with 3× supersampling (on top of devicePixelRatio) to stay crisp at the now-capped 3× zoom.animation.tswas restructured.Export pipeline rewrite (
asset-export.tsx, the biggest diff)canvas-record. Removed@ffmpeg/ffmpeg/@ffmpeg/utiln favor of thecanvas-record+media-codecslibraries using the browser's native H264 (AVC) encoder. The GIF format option was dropped — formats are nowframes | png | svg | mp4.html2canvas-pro— PNG/frame export now renders the buffer directly to an offscreen canvas (renderBufferToCanvas) rather than screenshotting the DOM. No morewaitForPaint/setTimeoutDOM-sync hacks.flattenSvgtoggle outlines glyphs into<path>data usingopentype.js, instead of emitting<text>/<tspan>.Text extraction moved to a testable module
app/lib/buffer-text.ts:getContent()(flat buffer → newline text) andgetColoredRows()(buffer → per-row colored segment runs). These replace the old DOM-scrapinggetContent/extractColoredRowsthat read from.ascii-animation pre, decoupling export logic from the DOM.Testing & tooling (new)
e2e/render-snapshot.spec.ts,playwright.config.ts): render-snapshot tests that drive the real app, wait for canvas paint + font readiness, and compare canvas bitmaps / exported assets against platform-specific PNG baselines (committed for chromium-darwin).tests/buffer-text.test.tsfor the new buffer module.package.jsontest scripts now scope totests/and addtest:e2e/test:e2e:update.AGENTS.mdwith build/lint/test/style conventions.