Skip to content

majiayu000/spellbook / skills/motion-stack

motion-stack

Verified

用代码做动效短片的通用底座:按 brief 从 20 个开源库(Three.js、PixiJS、p5、Paper、Matter、Rapier、anime.js、tsParticles、OGL、GL Transitions、Tone.js、Chatterbox、faster-whisper、Remotion、HyperFrames、FFmpeg 等)里挑最小组合,写成「画面是时间的纯函数」的场景,用本地无头渲染器出 MP4(可带离线合成的音效),并自动写出可复现清单(库版本、字体、文件哈希、引擎版本、命令)。当用户说「做个动效 / motion 短片 / 物理动画 / 3D 动画视频 / 用 three.js 做个视频 / 用这套 motion stack」时使用。MV、知识视频、尺寸图动画走各自专用 skill。只在明确请求时触发,忽略顺带提及。

FileKindSize
SKILL.mdskill md15.1 KB
examples/drop/package.jsonmanifest276 B
examples/drop/scene.htmlother5.2 KB
kit/env.mjsscript3.6 KB
kit/package.jsonmanifest337 B
kit/render.mjsscript18.7 KB
references/determinism.mdmarkdown3.5 KB
references/libraries.mdmarkdown3.5 KB

kit/env.mjs

View on GitHub
// Copy of dimensional-drawing-motion/adapters/headless/env.mjs (kept separate so this skill runs on its own).
// Find a Chromium and an ffmpeg that already exist on this machine, so the
// scripts run without `npx playwright install` or a PATH tweak.
import { existsSync, readdirSync } from 'node:fs';
import { join } from 'node:path';
import { homedir, platform } from 'node:os';
import { execFileSync } from 'node:child_process';
import { createRequire } from 'node:module';

const require = createRequire(import.meta.url);

function cacheDirs() {
  const h = homedir();
  return [
    process.env.PLAYWRIGHT_BROWSERS_PATH,
    platform() === 'darwin' && join(h, 'Library/Caches/ms-playwright'),
    platform() === 'linux' && join(h, '.cache/ms-playwright'),
    platform() === 'win32' && join(h, 'AppData/Local/ms-playwright'),
  ].filter(Boolean);
}

// Relative paths of the executable inside a ms-playwright browser folder.
const EXES = [
  'chrome-headless-shell-mac-arm64/chrome-headless-shell',
  'chrome-headless-shell-mac-x64/chrome-headless-shell',
  'chrome-headless-shell-linux64/chrome-headless-shell',
  'chrome-headless-shell-win64/chrome-headless-shell.exe',
  'chrome-mac-arm64/Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing',
  'chrome-mac-x64/Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing',
  'chrome-linux64/chrome',
  'chrome-mac/Chromium.app/Contents/MacOS/Chromium',
  'chrome-mac-arm64/Chromium.app/Contents/MacOS/Chromium',
  'chrome-linux/chrome',
  'chrome-win/chrome.exe',
];
const SYSTEM = [
  '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
  '/Applications/Chromium.app/Contents/MacOS/Chromium',
  '/usr/bin/chromium', '/usr/bin/chromium-browser', '/usr/bin/google-chrome',
];

export function findChromium() {
  if (process.env.CHROMIUM_PATH && existsSync(process.env.CHROMIUM_PATH)) return { path: process.env.CHROMIUM_PATH, from: 'CHROMIUM_PATH' };
  // What the installed playwright expects, if it is there.
  try {
    const p = require('playwright').chromium.executablePath();
    if (p && existsSync(p)) return { path: p, from: 'playwright default' };
  } catch {}
  // Newest cached build of any version: headless shell first, then full chromium.
  for (const dir of cacheDirs()) {
    if (!existsSync(dir)) continue;
    const names = readdirSync(dir).filter(n => /^chromium(_headless_shell)?-\d+$/.test(n))
      .sort((a, b) => (b.includes('headless') - a.includes('headless')) || (+b.split('-')[1] - +a.split('-')[1]));
    for (const n of names) for (const e of EXES) {
      const p = join(dir, n, e);
      if (existsSync(p)) return { path: p, from: `cache ${n}` };
    }
  }
  for (const p of SYSTEM) if (existsSync(p)) return { path: p, from: 'system browser' };
  return null;
}

export function findFfmpeg() {
  const cands = [process.env.FFMPEG_PATH, 'ffmpeg', '/opt/homebrew/bin/ffmpeg', '/usr/local/bin/ffmpeg', '/usr/bin/ffmpeg'].filter(Boolean);
  for (const c of cands) {
    try { execFileSync(c, ['-version'], { stdio: 'ignore' }); return { path: c, from: c === 'ffmpeg' ? 'PATH' : c }; } catch {}
  }
  // Playwright ships an ffmpeg for video recording, but without libx264, so it is only a last resort.
  return null;
}

export async function launch(opts = {}) {
  let chromium;
  try { ({ chromium } = require('playwright')); }
  catch { throw new Error('playwright is not installed: run `PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm install` in ' + new URL('.', import.meta.url).pathname); }
  const c = findChromium();
  if (!c) throw new Error('no Chromium found: run `npx playwright install chromium-headless-shell` or set CHROMIUM_PATH');
  return chromium.launch({ executablePath: c.path, ...opts });
}
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall