Communitygithub.com

vos-authoring

從頭編寫或除錯 vos 動畫程式 (VosConfigJson) — 宣告式配置可編譯為在 MIT 授權的 vos 引擎 (@vosjs/core) 上執行的確定性 Three.js + GSAP 方言動畫,並可透過 compileVosConfig 在本地端驗證。涵蓋 schema、方言規則、2D 疊加元素、著色器以及參數/預設值旋鈕。當被要求撰寫 vos 動畫程式、建立 VosConfigJson、製作程式化動態圖形或標誌動畫,或修復無法編譯或通過 lint 檢查的配置時使用。

vos-authoring 是什麼?

這是一個用於創作 VosConfigJson 動畫程式的技能。VosConfigJson 是一種宣告式配置格式,能夠編譯成在 vos 引擎上運行的確定性 Three.js 與 GSAP 方言動畫。此技能涵蓋了完整的 schema 結構、方言規則、2D 疊加元素、著色器參數以及 params/presets 參數化控制。 其工作流程包括:解析提示來理解動畫概念、設計攝影機與材質策略、生成有效的 JSON 配置檔,並透過 `@vosjs/core` 套件中的 `compileVosConfig` 在本地端進行驗證與渲染。它嚴格遵循一組規則以確保動畫的確定性、效能與正確性,例如禁止使用 TypeScript 語法、模板字面量或 `requestAnimationFrame`,並規定 `createContent` 與 `createTimeline` 必須回傳特定的結構。 此技能也支援透過 `params`(參數)與 `presets`(預設集)來製作可重複混搭的動畫,讓編輯器或 AI 代理無需修改原始碼即可調整視覺效果。此外,它也提供透過 CLI 或 HTTP API 將配置上傳至 vos.so 進行分享與託管的功能,支援免帳號的限時連結推送或 API Key 的永久推送。此技能適用於多種動畫類型,包括全螢幕著色器藝術、3D 物件動畫、等距視角、文字展示、玻璃折射效果以及粒子系統。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/vosjs/skills/tree/main/skills/vos-authoring

在你喜歡的 AI 中提問

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

說明文件

Vos 動畫程式創作

您將生成 VosConfigJson 檔案 — 一種宣告式動畫配置,可編譯為在 vos 引擎 (github.com/vosjs/vos,MIT 授權) 上執行的 Three.js + GSAP 方言動畫。預覽即為渲染結果:同一份配置在每台機器上 都會產生相同的影格。

工作流程

  1. 解析提示:識別動畫概念、氛围、顏色以及任何引用的圖片。
  2. 設計方法:選擇攝影機預設值、材質、效果和動畫策略(請參閱下方分類指南)。
  3. 生成配置:在專案存放配置的位置,將完整且有效的 VosConfigJson 寫入 <連字號-命名.json>。
  4. 在本地端驗證(見下方),然後渲染或預覽。

如果使用者提供了一張圖片,請分析其視覺風格(顏色、氛围、構圖、光線),並將這些特質轉化到場景中。

在本地端驗證與渲染

npm i @vosjs/core        # 編譯器 + lint 檢查
node -e "import('@vosjs/core/compiler').then(async m => { \
  const cfg = JSON.parse(require('fs').readFileSync('my-config.json','utf8')); \
  m.compileVosConfig(cfg); console.error('編譯通過') })"

compileVosConfig(config) 不得拋出錯誤 — 這是所有播放器和渲染伺服器 執行的同一個編譯器。若要進行視覺檢查,可以使用 CLI (npm i -D @vosjs/cli):

vos render my-config.json out.webm     # 確定性影片渲染
vos still  my-config.json out.webp --time 2.5
vos preview my-config.json             # 本地端播放頁面
vos info   my-config.json

分享以供預覽(無需帳號)

預設使用本地端渲染 — 除非使用者要求分享或託管,否則資料不會離開電腦。 當使用者想要看到它被託管(可播放的連結,在 vos.so 工作室進行微調) 但尚未配置 API 金鑰時,請使用可認領的推送:

vos push my-config.json --claimable --title "…"
# → claim: https://vos.so/claim/…   過期時間:<從現在起 72 小時>

# 沒有 CLI,或版本較舊?也可以透過普通的 HTTP 達成相同目的:
curl -s -X POST https://vos.so/api/claim \
  -H 'content-type: application/json' \
  -d '{"title": "…", "config": <VosConfigJson>}'
# → { "claimUrl": "https://vos.so/claim/…", "expiresAt": "…" }

將 claimUrl 交給使用者,切勿外流 — 它是唯一的參考憑證。 其有效期為 72 小時;未認領的作品將在此之後被刪除(如果過期可重新推送)。 認領會將該 vos 移動到使用者的資料庫中。如果已配置金鑰 (VOS_API_KEY 或 vos login),請優先使用 vos push — 使用金鑰的推送沒有過期時間。僅限程式,配置大小 ≤200KB,每個網路每天 5 次推送。

VosConfigJson 結構

{
  "version": 2,
  "duration": 8,
  "scene": { "background": "#0a0a1a", "fog": { "type": "exp2", "color": 0, "density": 0.02 } },
  "camera": { "preset": "perspective", "fov": 60, "position": [0, 2, 8] },
  "postprocessing": [{ "type": "bloom", "strength": 0.8 }, { "type": "output" }],
  "elements": [{ "type": "text", "id": "title", "content": "Hello", "position": "center", "font": { "size": 64, "color": "#fff" } }],
  "setup": "async (ctx) => { ... return data }",
  "createContent": "(ctx, setupData?) => { ... return { objects, refs, dispose } }",
  "createTimeline": "(ctx, content, duration) => { ... return tl }"
}

完整欄位參考:references/schema-reference.md。每種主要類型的運作範例:references/examples.md。

關鍵規則

必須

  1. 函數必須是有效的 JavaScript 字串 — 不能使用 TypeScript(不能使用 as、型別註解)
  2. 透過 ctx.THREE 存取 Three.js,透過 ctx.gsap 存取 GSAP 方言,透過 ctx.scene 存取場景
  3. createContent 必須回傳 { objects: [...], refs: {...}, dispose: () => {...} }
  4. createTimeline 必須回傳 ctx.gsap.timeline({ paused: true })
  5. 永遠包含能清理幾何體、材質、紋理的 dispose() 方法
  6. 對著色器的 iResolution 使用 ctx.resolution.drawingBufferWidth/drawingBufferHeight
  7. 為全螢幕著色器四邊形設定 mesh.frustumCulled = false
  8. 在全螢幕 ShaderMaterial 上設定 depthWrite: false, depthTest: false
  9. 使用後處理時,永遠將 { "type": "output" } 作為最後一個條目
  10. 將所有場景物件同時添加到 scene 和回傳的 objects 陣列中
  11. 直接補間著色器參數: tl.to(uniforms.iTime, { value: duration, duration, ease: 'none' })
  12. 對於逐影格邏輯(InstancedMesh 更新、攝影機計算),請使用補間上的 onUpdate 回呼

禁止

  1. 函數字串中不能有 ${} 模板字面量 — 它們會在編譯時被求值。請使用字串串接。
  2. 不能有跳脫的反引號 — 將著色器撰寫為內聯字串,或使用單行串接
  3. 永遠不要在單個補間上使用 repeat: -1 — 循環由播放器處理;這會破壞持續時間追蹤
  4. 不能有 CSS 風格的 style 物件或元素上的 textContent — 元素是 WebGL 平面
  5. 不能有外部匯入 — 所有東西都在 ctx 上(THREE、gsap、載入器、工具函數)
  6. 不能使用 requestAnimationFrame 或 setTimeout — 請使用 onUpdate 回呼
  7. 在影格路徑中不能使用 Date.now() / Math.random() — 確定性是合約;所有東西都應從時間軸的時間和 ctx.data 推導出來
  8. 新的配置中不能使用 onFrame — 將所有逐影格邏輯放在 onUpdate 中

參數與外觀(讓它可重混)

透過 config.params 宣告 2–4 個旋鈕 — 編輯器會將它們渲染為即時控制項, 其他 AI 代理可以在不接觸程式碼的情況下重新調整程式。每個參數都記錄了 程式會讀取的 ctx.data 鍵:

"params": [{ "key": "hue", "label": "色相", "kind": "number",
             "min": 0, "max": 1, "default": 0.6,
             "hint": "在色環上偏移每種顏色",
             "unit": "°", "group": "顏色", "order": 1 }]
  • kinds: number (min/max/step) | color | select (options) | toggle
  • hint:用一句話說明視覺上會改變什麼 — 請務必撰寫
  • 程式在其動畫邏輯中讀取它: const d = ctx.data || {}; if (typeof d.hue === 'number') u.uHue.value = d.hue
  • 根據意圖命名旋鈕(mood、drama、pace),永遠不要根據實作方式 (blurRadius)。每個旋鈕必須能明顯改變輸出 — 一個無效的旋鈕比沒有旋鈕更糟。

透過 config.presets 提供「外觀」 — 已命名的參數值組合(當程式有 4 個以上的參數時,提供 2–3 組):

"presets": [{ "name": "鮮豔", "values": { "hue": 0.9, "speed": 2 } },
            { "name": "平靜",  "values": { "hue": 0.3, "speed": 0.6 } }]

值必須引用已宣告的參數鍵,且型別須匹配。

伺服器端渲染注意事項

推送到 vos.so 的配置會在一個軟體 GL 叢集上進行預覽渲染:不能在傳輸材質上使用 THREE.DoubleSide(會導致硬體掛起),不能使用 dispersion(太慢), 且任何擷取的資源必須可存取且開放 CORS。這些限制僅適用於純本地端 且在真實 GPU 上的渲染。

設計原則

  • 視覺衝擊:使用 bloom 產生發光效果(即使 0.3–0.5 也能提升質感);發光材質 + bloom = 光源;exp2 霧(0.01–0.05)產生景深感;深色背景使色彩更突出;玻璃(傳輸 + HDR 環境貼圖)看起來高級;微妙的攝影機漂移增加生命力。
  • 動畫品質:4–10 秒循環,10–30 秒敘事;ease: 'none' 用於恆定運動;power2.inOut/sine.inOut 用於轉場;stagger 用於序列化揭示;在不同起始時間分層補間。
  • 顏色:最多使用 2–3 種互補色;暖色主色調 + 冷色邊緣光;深色調(0x0a0a1a、0x1a1a2e)用於背景。
  • 效能:10 個以上相同物件使用 InstancedMesh;Points 使用 5k–20k,InstancedMesh 使用 100–500;清理所有資源。

分類選擇指南

概念攝影機技術
著色器藝術 / 碎形fullscreenShaderMaterial + 參數補間
3D 物件perspectiveMesh + Material + 燈光
等距/平面orthographicInstancedMesh + 計算位置
文字展示perspective 或 fullscreenTextGeometry (3D) 或 elements (2D)
玻璃/折射perspectiveMeshPhysicalMaterial + HDR 環境貼圖
粒子perspectivePoints + 著色器或 InstancedMesh
混合媒體perspective3D 場景 + elements 陣列

Individual skills in this repo

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

launch-kit

Ship the media with the release — one take of the real product becomes YouTube demo, Chrome Web Store screenshots/tiles, Product Hunt gallery, social cuts, and OG cards; verified kit.json manifest.

vos-create

Create vos programs in the user

vosjs/product-video

Record and produce the demo video of a website, app, or feature with the vos CLI — the agent scripts the click path (actions.json), the recording auto-plans zooms, and every editing decision is data in doc.json, so fixes are edits and re-renders, never re-recordings. Renders are deterministic; export is free up to 4K with no watermark. Use when asked to make a product video, demo video, screen recording of a URL or feature, or a marketing clip, including a product behind a login (the session ladder: mint one from the project's own test auth before asking anyone), or when a feature was verified in agent-browser and that walk should become a take. A whole release's asset set (store listing, Product Hunt gallery, social cuts) is the launch-kit skill, which records through this one.

vosjs/vos-cut

Cut a screen recording (a vosso take) into the product video it was recorded for, from its evidence, with the vos CLI — read the take's digest (the moments the cursor track says mattered, each with a footage frame and a crop), narrate beats, edit doc.json by exception over the planners, verify with stills, and push an attributed version the human fine-tunes at vos.so; every edit is a data patch, so a re-cut never re-records. Use when asked to edit or cut a recording, make a product video or what's-new clip from a take, cut it like the last one, or cut a series of recordings in one style.

vosjs/vos-footage

Hand a Remotion, HyperFrames, or any video composition a clean captured clip of the real product — recorded and auto-zoomed with the vos CLI, delivered as full-bleed footage with no chrome, and always backed by an editable take on the maker's shelf, which the handoff says. Use when a composition needs real product footage, app or site b-roll, "capture our app for the video", or a screen-recorded segment to drop into another tool's timeline.

vosjs/vos-migrate

Turn an existing Loom, Screen Studio, Cap, or plain mp4/webm screen demo into an editable vosso take — re-encode the file, synthesize the take's metadata, plan, and push, so the old demo becomes a living document you re-cut instead of a file you re-record. Use when asked to "convert this Loom", "migrate our old demos", "re-edit this mp4", "make our Screen Studio recording editable", or to bring any already-recorded demo into vosso.

vos-remix

Remix a vos.so gallery program into your own — fetch its config, edit the declared knobs or code locally, validate with vos check, and push a private copy back with lineage that iterates as versions. Carries the params/Looks doctrine and the GLB 3D-showcase recipe. Use when asked to remix, customize or personalize a gallery animation, swap a 3D model into a showcase, or iterate a fetched program as versions.

相關技能