Skip to content

Fix: PNG download bakes only first frame of animated layers - #175

Merged
pablostanley merged 1 commit into
mainfrom
fix/download-bake-first-frame
May 16, 2026
Merged

Fix: PNG download bakes only first frame of animated layers#175
pablostanley merged 1 commit into
mainfrom
fix/download-bake-first-frame

Conversation

@pablostanley

Copy link
Copy Markdown
Owner

Summary

  • Creator download() used 5-arg drawImage(img, 0, 0, size, size) — stretched the entire sprite sheet (open+closed eyes etc.) into the output, so animated faces showed multiple frames side-by-side.
  • Switched to 9-arg form drawImage(img, 0, 0, NATIVE, NATIVE, 0, 0, size, size) so only frame 0 of each layer is sampled.
  • Works for any layer / any sub-animation kind (static/blink/sequence). Matches the source-rect pattern already used in drawOnCanvas (creator.tsx:86).

Test plan

  • Download an animated-eye combo (e.g. glasses, terminal-round, cheeky-terminal) at 240 / 480 / 960 / 1920 — face shows a single pair of eyes.
  • Download a static-eye combo — unchanged.
  • Hue + saturate + bg still bake correctly.
  • SVG and JSON downloads unaffected.

🤖 Generated with Claude Code

Creator `download()` used the 5-arg form of `drawImage`, which stretched
the whole image (including extra frame columns for blink/sequence parts)
into the canvas — animated eyes showed open + closed side-by-side.

Switched to the 9-arg form with a source rect of `(0, 0, NATIVE, NATIVE)`
so only the first 32×32 frame of each layer is sampled. Mirrors what
`drawOnCanvas` already does for live preview. Works for every layer
(eyes/heads/body/top) and every kind (static/blink/sequence).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@pablostanley
pablostanley merged commit 2389ddb into main May 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant