Communitygithub.com

Varnan-Tech/opendirectory

根據內容摘要生成動態圖形影片(MP4)。使用 Playwright 在無頭 Chromium 中逐幀渲染多場景 HTML/CSS 動畫,並透過 FFmpeg 組裝。預設 1080×1080,支援 16:9 (1920×1080) 和 9:16 (1080×1920)。提供 5 種樣式預設。

opendirectory 是什麼?

此技能可根據文字內容摘要自動生成動態圖形影片(MP4)。它使用 Playwright 在無頭 Chromium 中逐幀渲染 HTML/CSS 動畫,並透過 FFmpeg 將 PNG 幀組裝成最終影片。核心架構為基於 JavaScript 的 `window.renderFrame(t)` 函數,該函數根據時間(毫秒)直接計算每個場景的不透明度和變形,從而避免使用 CSS `@keyframes` 可能導致的尋幀問題。此技能支援多種寬高比(1:1、16:9、9:16)、幀率(24、30、60 fps)以及五種風格預設(kinetic-dark、editorial-light、data-pulse、bold-type、minimal-clean)。它不依賴 React、AI API 或 Python,僅需字型 CDN 連結。此技能主要設計給 Claude Code 等 AI 代理使用,用戶只需提供內容摘要,代理便會自動解析場景、生成 HTML 檔案、執行 Playwright 和 FFmpeg 腳本,最終產出影片。

相容平台✓Claude Code~Codex CLI~Cursor✓Gemini CLI
npx skills add https://github.com/Varnan-Tech/opendirectory/tree/main/skills/vid-motion-graphics

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

vid-motion-graphics

根據內容摘要生成多場景動態圖形 MP4 影片。使用 Playwright 在無頭 Chromium 中渲染 HTML/CSS 動畫(Web Animations API 尋幀),並以 FFmpeg 組裝 PNG 幀。不需要 React、AI API 或 Python——除了 graphic-gif 家族之外,無需任何新的依賴項。

僅使用 CDN 字型。HTML 中不使用外部函式庫。


關鍵規則(每次生成前務必閱讀)

  1. 使用 window.renderFrame(t)——不要使用 CSS @keyframes 處理場景轉場。 在 Chromium 中,CSS 動畫 currentTime 的向後搜尋會被靜默忽略。renderFrame 方法:一個純 JS 函數直接根據毫秒計算 opacity/transform。Playwright 每幀呼叫一次。確定性高、無競爭條件。
  2. 任何元素上均不得使用 animation-delay。 使用 renderFrame 時不需要。如果你發現自己在寫 animation-delay,請停止——你正在使用錯誤的架構。
  3. window.__videoReady = true 只能放在 document.fonts.ready.then(...) 內部。 絕對不要同步設定——Playwright 捕捉第 1 幀之前必須載入字型,否則文字會以後備字型渲染。
  4. 必須暴露 window.__stopPreview()。 瀏覽器的 rAF 預覽迴圈會與 Playwright 的 evaluate/screenshot 呼叫產生競爭。capture-frames.mjs 會在幀迴圈之前呼叫 __stopPreview()。務必包含它。
  5. 場景邊界檢查使用 t < startMs(而不是 <=)。 在幀 0 時使用 t <= 0 會導致場景 1 顯示為黑色。正確的防護條件是 if (t < startMs || t >= endMs) return hidden。
  6. Body 必須使用精確的像素尺寸。 寬度和高度必須是整數(1080px、1920px)。不要使用 %、vw/vh 或響應式單位。
  7. 同一時間不得有兩個場景同時可見(10% 的進入重疊除外)。所有場景在其 renderFrame 視窗外都必須是 opacity: 0。
  8. 轉場僅使用 opacity。 不要使用 display 切換或 visibility——GPU 合成的不透明度可以達到幀完美。
  9. 不要在聊天中傾印 HTML。 將其儲存到檔案,僅顯示摘要。
  10. 標題應說明訊息,而非主題。 例如 "3 Reasons Q4 Crushed Targets",而不是 "Q4 2024 Performance Video"。
  11. 在生成任何 HTML 之前,請閱讀 references/scene-library.md。 使用該檔案中的精確 HTML 結構和 CSS 類別名稱。

步驟 1:接收

必要參數: content_brief

可選參數與預設值:

參數預設值說明
content_brief—描述影片要傳達內容的文字(必要)
scenesauto場景數量(1–6)。Auto 會根據內容摘要推斷。
duration_per_scene3s每個場景的持續時間(秒)(1–8s)
stylekinetic-darkkinetic-dark / editorial-light / data-pulse / bold-type / minimal-clean
aspect_ratio1:11:1 (1080×1080) / 16:9 (1920×1080) / 9:16 (1080×1920)
fps30每秒幀數(24、30 或 60)
musicnone背景音軌的檔案路徑(mp3/m4a/wav)
source—在最後一幀頁尾顯示的來源歸屬

如果缺少 content_brief,請準確詢問:

"要建立影片,我需要一個內容摘要——影片應該傳達什麼?

範例:'顯示 Q4 營收成長 85% 的三個原因:新的企業交易、客戶流失減少、價格調漲。使用粗體數字。風格:data-pulse。'

可選:風格(預設:kinetic-dark)、寬高比(預設:1:1)、每個場景的秒數(預設:3 秒)"

如果提供了 content_brief → 立即進行到步驟 2。


步驟 2:內部架構(永遠不向用戶顯示)

1. 將內容摘要解析為場景(最多 6 個):

  • 場景 1 = 鉤子或標題(始終)
  • 場景 2 到 N-1 = 支援論點、指標或故事節奏
  • 場景 N = CTA 或結束總結(如果場景多於一個則始終存在)
  • 每個場景一個關鍵想法——如果摘要包含 7 個以上的想法,則合併最弱的部分

2. 閱讀 references/scene-library.md——為每個場景選擇場景類型:

  • 鉤子/開場 → title-card
  • 單一指標 → stat-reveal
  • 2–4 個項目的列表 → bullet-list
  • 前後對比 / 兩個數值 → split-screen
  • 推薦 / 引言 → quote-card
  • 結尾 / CTA → cta-card

3. 閱讀 references/style-presets.md——為所選風格載入 CSS 權杖和動畫個性。

4. 計算時間:

totalDuration = sceneCount × duration_per_scene  (秒)
totalFrames   = totalDuration × fps

每個場景佔據 @keyframes 總範圍的 (100 / sceneCount)%。

場景起始 %結束 %
10%(100/N)%
2(100/N)%(200/N)%
………
N((N-1)×100/N)%100%

在每個場景的範圍內:

  • 進入:場景範圍的前 10%
  • 停留:場景範圍的 10% 到 85%
  • 退出:場景範圍的 85% 到 100%

5. 決定像素尺寸:

  • 1:1 → W=1080, H=1080
  • 16:9 → W=1920, H=1080
  • 9:16 → W=1080, H=1920

步驟 3:HTML 生成

在編寫任何程式碼之前,請閱讀 references/scene-library.md 和 references/style-presets.md。

必要的 HTML 結構:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
[字型 CDN 連結來自風格預設]
<style>
:root {
  [來自風格預設的所有 CSS 權杖]
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  width: [W]px; height: [H]px;
  overflow: hidden;
  background: var(--bg);
  font-family: var(--font-body);
  position: relative;
}

.scene {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px;
  opacity: 0;
  will-change: opacity, transform;
}
.scene-inner {
  width: 100%;
  max-width: 960px;
}

/* 來自 scene-library.md 的場景類型 CSS */
[在此貼上場景類型 CSS]
</style>
</head>
<body>

<div class="scene scene-1">
  <div class="scene-inner">
    [來自 scene-library.md 模板的場景 1 HTML]
  </div>
</div>

[為每個場景重複]

<script>
window.__videoReady = false;
window.TOTAL_DURATION_MS = [totalDuration * 1000];

// ── 動畫輔助函式 ─────────────────────────────────────────────────────────
function lerp(a, b, p) { return a + (b - a) * p; }
function clamp(v, lo, hi) { return Math.max(lo, Math.min(hi, v)); }
function easeOutCubic(t) { return 1 - Math.pow(1 - clamp(t, 0, 1), 3); }

function sceneState(t, startMs, endMs) {
  if (t < startMs || t >= endMs) return { opacity: 0, ty: 0 };
  const prog = (t - startMs) / (endMs - startMs);
  if (prog < 0.10) {
    const p = easeOutCubic(prog / 0.10);
    return { opacity: p, ty: lerp(24, 0, p) };
  }
  if (prog < 0.85) return { opacity: 1, ty: 0 };
  const p = (prog - 0.85) / 0.15;
  return { opacity: 1 - p, ty: lerp(0, -12, p) };
}

function applySceneState(el, state) {
  el.style.opacity = state.opacity;
  el.style.transform = state.ty !== 0 ? `translateY(${state.ty.toFixed(2)}px)` : '';
}

// ── 主要渲染函式——由 Playwright 每幀呼叫一次 ────────────────────────────────
window.renderFrame = function(t) {
  // 場景 1:0ms – [D]ms
  applySceneState(document.querySelector('.scene-1'), sceneState(t, 0, [D]));
  // 場景 2:[D]ms – [2D]ms
  applySceneState(document.querySelector('.scene-2'), sceneState(t, [D], [2D]));
  // ... 為每個場景重複 ...
};

// ── 預覽迴圈——由 Playwright 在幀捕捉前停止 ─────────────────────────────────
let __previewActive = false;
let __previewRafId = null;
window.__stopPreview = function() {
  __previewActive = false;
  if (__previewRafId !== null) { cancelAnimationFrame(__previewRafId); __previewRafId = null; }
};

document.fonts.ready.then(() => {
  window.renderFrame(0);
  window.__videoReady = true;
  __previewActive = true;
  const startTime = performance.now();
  function previewTick() {
    if (!__previewActive) return;
    const elapsed = performance.now() - startTime;
    if (elapsed < window.TOTAL_DURATION_MS) {
      window.renderFrame(elapsed);
      __previewRafId = requestAnimationFrame(previewTick);
    } else {
      window.renderFrame(window.TOTAL_DURATION_MS - 1);
      __previewActive = false;
    }
  }
  __previewRafId = requestAnimationFrame(previewTick);
});
</script>
</body>
</html>

設計品質規則:

  • 標題字型大小:永遠不小於 60px——文字必須在手機縮圖大小下清晰可讀
  • 數字和統計數據:始終是螢幕上最大的元素(120–200px)
  • 顯示字型使用緊密字距:-0.02em 到 -0.04em
  • 每個場景使用一個強調色——不要將強調色分散到多個元素上
  • 深色預設:分隔線 rgba(255,255,255,0.10),絕不使用實色
  • 淺色預設:分隔線 rgba(0,0,0,0.10),絕不使用實色
  • 每個使用 transform 的元素都要設定 transform-origin: center center
  • .scene 內部的內距:至少 80px——絕不讓文字觸及視窗邊緣

步驟 4:自我品質驗證(在步驟 5 之前修正所有失敗)

renderFrame 正確性:

  • window.renderFrame(t) 已定義——純函數,除樣式寫入外無副作用
  • 場景邊界使用 t < startMs(而不是 t <= startMs)——避免第 0 幀出現黑色
  • 場景轉場中零個 animation-delay 或 @keyframes 實例
  • 沒有兩個場景具有重疊的 opacity: 1 視窗(10% 進入重疊除外)
  • 已暴露 window.__stopPreview() 且預覽 rAF 迴圈會檢查 __previewActive

就緒訊號:

  • window.__videoReady = false 在 document.fonts.ready 之前宣告
  • window.__videoReady = true 僅在 document.fonts.ready.then(...) 內部設定
  • window.renderFrame(0) 在 document.fonts.ready.then(...) 內部、__videoReady = true 之前呼叫

版面配置:

  • html, body 使用精確像素尺寸([W]px、[H]px)
  • body 的寬度/高度上沒有 %、vw、vh、rem 單位
  • html, body 設定 overflow: hidden
  • 所有場景 position: absolute; inset: 0

設計:

  • 所有顏色來自風格預設權杖——沒有無關的十六進位值
  • 所有字型來自風格預設——沒有無關的 font-family 字串
  • 標題字型大小 ≥ 60px
  • 如果提供了 source 參數,最終場景中需有來源

步驟 5:匯出

根據內容摘要確定 slug(kebab-case,≤30 個字元):

mkdir -p chart/[slug]

儲存 HTML:chart/[slug]/video.html

瀏覽器預覽:

open chart/[slug]/video.html

執行匯出(將 [skill-root] 替換為此技能的目錄路徑):

bash [skill-root]/scripts/export-video.sh \
  chart/[slug]/video.html \
  chart/[slug]/video.mp4 \
  --duration [totalDuration] \
  --fps [fps] \
  --width [W] \
  --height [H] \
  [--music path/to/audio.mp3]

該腳本會在首次執行時安裝 Playwright(約 200MB Chromium),捕捉所有幀,然後使用 FFmpeg 組裝 MP4。


步驟 6:輸出摘要

## 影片:[來自內容摘要的標題]
日期:[YYYY-MM-DD] | 場景數:[N] | 風格:[style] | 比例:[ratio]
時長:[N] 秒 | FPS:[fps] | 幀數:[N]

檔案
  原始檔:  chart/[slug]/video.html
  輸出檔:  chart/[slug]/video.mp4
  大小:     [X] MB

檢查清單
- [ ] 所有場景按順序出現,無空白幀
- [ ] 文字在手機縮圖大小下清晰可讀
- [ ] 場景轉場流暢(無跳接剪輯)
- [ ] 最終場景包含 CTA 或結尾訊息
- [ ] 最終幀中包含來源歸屬(如果已提供)

提示(當用戶尋求指導時顯示)

"提供一個內容摘要——每個場景應該說什麼的條列要點。"

"直接說出洞察。'3 reasons Q4 grew 85%' 能為影片提供主軸。"

"如果你有偏好,請提及風格:kinetic-dark(預設)、editorial-light、data-pulse、bold-type、minimal-clean。"

"根據平台指定寬高比:LinkedIn/Instagram 動態消息使用 1:1,Stories/Reels 使用 9:16,YouTube/簡報使用 16:9。"

✅ 良好範例:"Create a 9-second video. Q4 revenue hit $4.2M (85% growth). Drivers: enterprise deals, churn 1.2%, price increase. CTA: acme.com/q4. Style: data-pulse. Aspect: 1:1."

❌ 不良範例:"make a video about our company"

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

Varnan-Tech/opendirectory

Use when the user asks to generate a blog cover image, thumbnail, or article header. Automatically uses modern typography, brand logos, and Google Search grounding to create beautiful 16:9 images with Gemini 3.1 Flash Image Preview.

Varnan-Tech/opendirectory

World-class brand strategist and naming expert. Uses an interrogation-led discovery phase to extract your brand's DNA, then applies scientific naming frameworks (Phonosemantics) and automated multi-TLD domain checking.

Varnan-Tech/opendirectory

Use when the user asks to generate or update a project's CLAUDE or AGENTS context file from a codebase scan. Writes a focused file under 100 lines containing only the non-obvious build commands, conventions, and gotchas Claude Code needs.

Varnan-Tech/opendirectory

Use when the user wants to verify cold emails, enrich a lead list, or autonomously guess email addresses from a CSV using ValidEmail.co or the open-source Reacher engine.

Varnan-Tech/opendirectory

Competitive intelligence orchestrator tracking companies across 8+ platforms (GitHub, Twitter, Reddit, HN, PH, YC Jobs) with heat scores and AI briefings.

Varnan-Tech/opendirectory

Give it your product URL or description. It finds your top 5 competitors, runs three-track PR research across all of them (editorial, podcasts, communities), identifies which channels appear most frequently, looks up the journalist or host for each, and returns a tiered outreach list with story angles and ready-to-send cold pitch drafts tailored to your product. Use when asked to find PR opportunities, discover where competitors got featured, build a media outreach list, find which journalists cover my space, or get pitch templates for press coverage.

Varnan-Tech/opendirectory

Generate high-converting, deep-dive growth case studies in MDX format. Use this skill when asked to write a case study or blog post about a company's growth, tech stack, or product-led strategy. It handles the full pipeline (researching the company via Tavily, generating a 16:9 cover image, quality checking the draft, uploading assets to cloud storage, and pushing directly to the target repository).

Varnan-Tech/opendirectory

Scans your project for outdated npm, pip, Cargo, Go, or Ruby packages. Runs a CVE security audit. Fetches changelogs, summarizes breaking changes with Gemini, and opens one PR per risk group (patch, minor, major). Includes Diagnosis Mode for install conflicts. Use when asked to update dependencies, check for outdated packages, open dependency PRs, scan for package updates, audit for CVEs, or flag breaking changes in upgrades. Trigger when a user says "check for outdated packages", "update my dependencies", "open PRs for dependency updates", "scan for CVEs", or "which packages need upgrading".

Varnan-Tech/opendirectory

Generates and updates README.md and API reference docs by reading your codebase's functions, routes, types, schemas, and architecture. Uses graphify to build a knowledge graph first, then writes accurate docs from it. Use when asked to write docs, generate a README, document an API, update stale docs, create an API reference from code, add an architecture section, or document a project in any language. Trigger when a user says their docs are missing, outdated, or wants to document their codebase without writing it manually.

Varnan-Tech/opendirectory

Evaluates expired domain candidates against a target niche, scores them by topical relevance, historical activity level, and history cleanliness, then outputs a ranked shortlist with explainable reasoning and risk flags.

Varnan-Tech/opendirectory

Brutally honest developer-experience audit for a GitHub repo. Scores 10 DX dimensions (time-to-first-success, README clarity, visual proof, install, quick-start, docs, examples, community, trust, marketing), writes a shareable roast in the requested tone (brutal/honest/kind), produces a prioritized action plan ranked by impact × effort, and sketches an ideal README. Trigger when user says "roast my repo", "audit my README", "dx audit", "developer experience review", "score my GitHub project", "before launch checklist", or "make my repo shareable".

Varnan-Tech/opendirectory

Drafts and designs a complete HTML email newsletter from a topic or content brief. Outputs paste-ready HTML for Loops, Mailchimp, Beehiiv, Resend, or any standard email platform. Includes subject line options and plain-text fallback. Trigger when a user says "write a newsletter", "draft an email newsletter", "create an HTML email", "design an email for my subscribers", or "write a newsletter about [topic]".

Varnan-Tech/opendirectory

Takes a GitHub PR URL or the current branch and writes a plain-English explanation of what it does and why, then posts it as a PR comment. Use when asked to explain a PR, summarize a pull request, write a plain-English description of a PR, add a summary comment to a PR, or understand what a PR changes. Trigger when a user says "explain this PR", "summarize this pull request", "what does this PR do", "add a comment explaining the PR", or shares a GitHub PR URL and asks what it does.

Varnan-Tech/opendirectory

Audit how often LLMs recommend your brand vs competitors and generate a GEO action plan.

Varnan-Tech/opendirectory

Takes a competitor's public GitHub repo URL, fetches their open issues via the GitHub REST API, filters noise locally, clusters issues into 6 demand categories, computes a demand score per issue and per cluster, and outputs a ranked demand gap report with a GTM messaging brief. Use when asked to scan a competitor's GitHub issues, find what their users are begging for, turn GitHub complaints into product positioning, identify competitor feature gaps, or generate messaging from real user demand. Trigger when a user says "scan competitor issues", "what are users asking for on X repo", "find demand gaps in Y", "turn GitHub issues into messaging", or "what should I build based on competitor complaints".

Varnan-Tech/opendirectory

Find recurring confusion in your repo's GitHub Discussions, rank it by urgency, and draft the actual docs fixes and content angles — with verbatim community quotes and source links as evidence.

Varnan-Tech/opendirectory

SEO keyword research workflow for blog generation using Google Trends data. Use when writing blog posts, planning content calendars, or optimizing articles for search engines. Finds breakout keywords, builds content structure, and generates SEO-optimized blog outlines targeting tech and developer audiences.

Varnan-Tech/opendirectory

Generates a professionally designed case study PDF for B2B SaaS sales and marketing. Supports 7 page layouts, 9 style presets, 1-4 page output. Trigger when user says "create a case study", "write a customer story", "make a case study PDF", "design a success story", "turn this customer win into a PDF".

Varnan-Tech/opendirectory

Generates data visualization charts (bar, line, area, pie, doughnut, scatter, radar, treemap) as PNG using Apache ECharts v6. 1080×1080px default, 5 style presets, highlight annotations. Trigger when user says "create a chart", "visualize data", "make a bar chart", "line graph", "pie chart", "data visualization", "chart this data", "plot", "graph", or "visualize these numbers".

Varnan-Tech/opendirectory

Fetches low-star App Store and Google Play reviews, clusters them into broken-promise patterns, and generates a ranked copy brief with positioning opportunities.

相關技能