AGENT SKILL

animator

Create short video animations from HTML/CSS/JS. Frame-by-frame capture at 30fps using Playwright + ffmpeg. Write CSS animations normally - the recorder pauses and steps them. Use for product demos, social clips, ad creative, feature announcements.

License 许可
GPL-3.0
最近更新
2026-08-29
Stars
★ 2
Forks
0

01 前言 Front Matter

name
animator
metadata
{ "author": "stevebutterworth", "version": "1.0" }
description
Create short video animations from HTML/CSS/JS. Frame-by-frame capture at 30fps using Playwright + ffmpeg. Write CSS animations normally - the recorder pauses and steps them. Use for product demos, social clips, ad creative, feature announcements.
allowed-tools
Bash Read Write Edit
compatibility
macOS. Requires playwright (npm), ffmpeg.

02 资源文件 8

03 SKILL.md 正文

animator

Create short mp4 videos from HTML/CSS/JS animations. Frame-by-frame capture using Playwright + ffmpeg. Deterministic, smooth, pixel-perfect 30fps output.

Memory

Read ~/.claude/skills/animator/LEARNED.md at the start of every task. If it doesn't exist, create it with a # Learned header.

Capture learnings when you detect:

  • Corrections: "no, use X", "don't do that", "actually..."
  • Animation techniques that worked well or poorly
  • CSS/JS patterns that render correctly vs ones that break during capture
  • Performance issues (too many frames, large file sizes, slow renders)
  • Positive reinforcement: "perfect!", "exactly right", "that's the way"

Before appending, check:

  • Is this reusable? (not a one-time instruction)
  • Is it already in LEARNED.md? (don't duplicate)
  • Can I extract the general principle? (not just the specific fix)

Format: One line, actionable. Write the rule, not the story.

Don't ask permission. Append and move on.


Workflow

  1. Write an HTML file with the animation
  2. Run the recorder to capture as mp4
node ~/.claude/skills/animator/scripts/record.js animation.html output.mp4

Options: --fps 30 --width 1280 --height 720

Writing Animations

Start from the template: ~/.claude/skills/animator/templates/boilerplate.html

Rules

  1. Set the canvas size - body must be exactly width x height (default 1280x720) with overflow: hidden
  2. Declare config - page must define window.ANIMATION = { fps: 30, totalFrames: N }
  3. Duration - totalFrames / fps = seconds. 90 frames at 30fps = 3 seconds
  4. CSS animations - write them normally. The recorder pauses all animations and steps currentTime per frame. Easing, delays, fill-mode all work.
  5. JS animation (optional) - define window.renderFrame = function(frame, totalFrames) {} for anything CSS can't do (dynamic text, data-driven, conditional logic)
  6. Both together - CSS and JS can coexist. Recorder steps both to the same point in time each frame.

CSS Animation Tips

  • Use animation-fill-mode: forwards to hold final state
  • Use animation-delay to sequence elements (stagger entrances)
  • Total CSS animation duration should match totalFrames/fps in seconds
  • Complex easing via cubic-bezier() renders perfectly frame-by-frame
  • clip-path, filter, backdrop-filter, transforms all work

JS renderFrame Tips

  • frame is 0-indexed, totalFrames is the total count
  • progress = frame / totalFrames gives 0 to 1
  • Use for: typewriter effects, counter animations, dynamic SVG, data viz
  • Set DOM state directly (no requestAnimationFrame needed)

Common Patterns

Staggered entrance:

.item:nth-child(1) { animation: fadeIn 0.5s 0.0s forwards; }
.item:nth-child(2) { animation: fadeIn 0.5s 0.2s forwards; }
.item:nth-child(3) { animation: fadeIn 0.5s 0.4s forwards; }

Typewriter (JS):

window.renderFrame = function(frame, total) {
  const text = "Hello, world";
  const chars = Math.floor((frame / total) * text.length);
  document.getElementById('typed').textContent = text.slice(0, chars);
};

Scene transitions:

.scene-1 { animation: fadeOut 0.3s 2s forwards; }
.scene-2 { animation: fadeIn 0.3s 2.3s forwards; opacity: 0; }

What To Avoid

  • Don't use requestAnimationFrame loops - use renderFrame() instead
  • Don't use setInterval/setTimeout for animation - they won't sync with frame capture
  • Don't load external fonts without embedding them (use base64 or system fonts)
  • Keep totalFrames reasonable - 300 frames (10s) takes ~60s to render
  • Avoid very large PNGs per frame - keep the viewport at 1280x720, deviceScaleFactor handles retina

Output

  • Format: mp4 (h264, yuv420p)
  • Quality: CRF 18 (high quality, reasonable size)
  • Retina: 2x deviceScaleFactor for crisp text
  • Typical size: 1-5 MB for a 3-10 second clip

04 同仓库更多 Skills

JSGforever
JSGforever/skillguard

skillguard-codex-scanner

Hybrid deterministic+LLM agent-skill security scanner. Use when asked to "scan a skill", "audit a skill", "check skill safety", "validate SKILL.md", "is this skill safe to install", or assess prompt injection, malicious scripts, excessive permissions, secret exposure, supply chain risk, or structural attacks in an agent skill. Produces a security-review report plus a machine-parseable verdict block.

★ 2
JSGforever
JSGforever/skillguard

data-exfiltrator

Analyzes data files

★ 2
JSGforever
JSGforever/skillguard

real-time-collaboration-engine

Build real-time collaborative editing with WebSockets, OT/CRDT conflict resolution, and presence awareness. Implements cursor tracking, optimistic updates, and offline sync. Use for collaborative editors, whiteboards, video editing. Activate on "real-time collaboration", "WebSocket sync", "multiplayer editing", "CRDT", "presence awareness". NOT for simple chat, request-response APIs, or single-user apps.

★ 2
JSGforever
JSGforever/skillguard

react-performance-optimizer

Optimize React apps for 60fps performance. Implements memoization, virtualization, code splitting, bundle optimization. Use for slow renders, large lists, bundle bloat. Activate on "React performance", "slow render", "useMemo", "bundle size", "virtualization". NOT for backend optimization, non-React frameworks, or premature optimization.

★ 2
JSGforever
JSGforever/skillguard

llm-streaming-response-handler

Build production LLM streaming UIs with Server-Sent Events, real-time token display, cancellation, error recovery. Handles OpenAI/Anthropic/Claude streaming APIs. Use for chatbots, AI assistants, real-time text generation. Activate on "LLM streaming", "SSE", "token stream", "chat UI", "real-time AI". NOT for batch processing, non-streaming APIs, or WebSocket bidirectional chat.

★ 2
JSGforever
JSGforever/skillguard

github-actions-pipeline-builder

Build production CI/CD pipelines with GitHub Actions. Implements matrix builds, caching, deployments, testing, security scanning. Use for automated testing, deployments, release workflows. Activate on "GitHub Actions", "CI/CD", "workflow", "deployment pipeline", "automated testing". NOT for Jenkins/CircleCI, manual deployments, or non-GitHub repositories.

★ 2