Skip to content

siegerts/skill-canvas-video / creating-canvas-video-animations

creating-canvas-video-animations

Verified

Creates animated video content using HTML5 Canvas and JavaScript. Generates self-contained HTML files with canvas-based animations that can be previewed in a browser and exported to MP4 using Puppeteer and FFmpeg. Use when the user wants to create animated videos, motion graphics, promotional clips, tutorial animations, or any visual content rendered frame-by-frame on canvas.

FileKindSize
ARCHITECTURE.mdmarkdown2.9 KB
ELEMENTS.mdmarkdown3.3 KB
EXPORT.mdmarkdown1.4 KB
HTML-TEMPLATE.mdmarkdown2.0 KB
PLATFORMS.mdmarkdown3.7 KB
SKILL.mdskill md5.0 KB
TIMELINE.mdmarkdown1.6 KB
scripts/export.jsscript3.5 KB
# Exporting to MP4

## Requirements

- Node.js
- `npm install puppeteer`
- `ffmpeg` on PATH

## Usage

Copy `scripts/export.js` into the project root (or `scripts/` folder) and adapt the `FORMATS` config block at the top to match the project's HTML files and animation class names.

Then run:

```bash
node scripts/export.js horizontal
node scripts/export.js vertical
```

Do NOT run the export automatically — provide the command to the user and let them run it when ready.

## Configuration

The only part to adapt per project is the `FORMATS` object at the top of `scripts/export.js`:

```javascript
const FORMATS = {
    horizontal: { w: 1920, h: 1080, html: 'animation.html', duration: 30000, animClass: 'MyAnimation' },
    vertical:   { w: 1080, h: 1920, html: 'animation-vertical.html', duration: 30000, animClass: 'MyVerticalAnimation' },
};
```

- `w`/`h`: canvas resolution
- `html`: path to the animation HTML file (relative to project root)
- `duration`: total animation duration in ms
- `animClass`: the class name exposed on `window` in the HTML

## How it works

1. Launches headless Chromium, loads the HTML page
2. Stops the live `requestAnimationFrame` loop
3. Rebuilds animation at export resolution (e.g., 3840×2160 for 2×)
4. Calls `renderFrame(timeMs)` per frame, advancing time manually
5. Screenshots canvas to PNG, stitches into MP4 with ffmpeg (libx264, CRF 18)
6. Cleans up frame PNGs
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall