Automated tools for capturing GIFs and screenshots of projects using Playwright.
cd /Users/dereklomas/CodeVibing/codevibing
npm install
npx playwright install chromium# GIF (default 6 seconds)
npm run capture -- --url http://localhost:3000 --output public/previews/my-project.gif
# Screenshot
npm run capture -- --url http://localhost:3000 --screenshot --output public/previews/my-project.png
# Longer recording with skip
npm run capture -- --url https://xwhysi.com --duration 10 --skip 2 --output xwhysi.gif# Click a button, wait, scroll
npm run capture -- --url http://localhost:3000 \
--interactions "wait:2000,click:button.start,wait:1000,scroll:500" \
--duration 10 \
--output demo.gif# List configured projects
npm run capture:list
# Capture all
npm run capture:all
# Capture one specific project
npm run capture:all -- santa-express| Command | Example | Description |
|---|---|---|
click |
click:.btn |
Click an element |
wait |
wait:2000 |
Wait N milliseconds |
scroll |
scroll:500 |
Scroll down N pixels |
hover |
hover:.card |
Hover over element |
type |
type:#input|hello |
Type text into input |
key |
key:ArrowRight |
Press a key |
- Skip loading screens: Use
--skip 2to trim the first 2 seconds - Wait for content: Use
--wait ".main-content"to wait for selector - Stage interactions: Use interactions to navigate to the interesting part
- Right duration: 6-10 seconds is usually enough
| Format | Default Size | Notes |
|---|---|---|
| GIF | 800px wide, 12fps | Optimized with palette |
| PNG | 1280x800 | Full viewport |
| MP4 | 1280x800 | H.264, good quality |
Edit scripts/capture-gallery.ts and add to the PROJECTS array:
{
id: 'my-project',
name: 'My Cool Project',
url: 'http://localhost:3000',
type: 'gif', // or 'screenshot' or 'both'
duration: 8,
interactions: ['wait:2000', 'click:.demo-button'],
notes: 'Show the animation after clicking the button',
}- Node.js 18+
- ffmpeg (for GIF conversion)
- Playwright Chromium browser
Install ffmpeg on Mac:
brew install ffmpeg