Communitygithub.com

evalix098/tiktoklive

僅限 Grok Build。將一張 2D 角色靜態圖透過 imagine_text_to_image 基底 → imagine_image_to_video(6 秒/10 秒原地動作)→ ffmpeg 影格 → magenta 色鍵 → 密集取樣條狀圖/網格/GIF,轉換為更密集的動畫精靈。當使用者需要影片轉精靈、流暢的奔跑/行走循環,或更密集的中間姿勢時使用。清晰的製作級像素圖請優先使用 generate2dsprite。觸發詞包括「video to sprite」、「imagine_image_to_video sprite」、「dense walk cycle」、「smooth run animation from video」。

tiktoklive 是什麼?

此技能(Grok Build 專用)將靜態 2D 角色插畫,透過 AI 影片生成工具轉換為密集的動畫精靈影格。流程為:先以 imagine_text_to_image 或 imagine_image_to_image 建立帶有純洋紅色背景的清晰基底靜態圖,再以 imagine_image_to_video 產生原地動作(跑步、行走等)的短影片,接著用 ffmpeg 與自訂 Python 腳本進行影格萃取、洋紅色色鍵去背、正規化與取樣,最後輸出為條狀圖、網格或預覽 GIF。技能支援 8、16、24、48 等不同影格數的密集輸出,預設 128×128 像素的單元格大小。主要用途是為遊戲開發者提供比傳統逐張繪製更流暢的中間動作,特別適合需要密集過渡姿勢的奔跑或行走循環。然而,由於影片生成的像素較模糊、角色辨識度可能飄移且有色鍵邊緣殘留,因此僅建議作為實驗性或輔助流程,正式的遊戲精靈表仍應優先使用 generate2dsprite。技能仰賴 Grok Build 的影像與影片生成工具,無法在其他平台上執行,若缺乏相應工具則會明確告知使用者並建議替代方案。

相容平台✓Claude Code✓Codex CLI~Cursor
npx skills add https://github.com/evalix098/tiktoklive/tree/HEAD/.grok/skills/video2dsprite

在你喜歡的 AI 中提問

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

說明文件

Video2dsprite(僅限 Grok Build)

將基礎 2D 角色圖片轉換為密集動畫精靈,使用 Grok Build 原生的影片工具。

App-builder / Grok 環境

項目值
技能目錄.grok/skills/video2dsprite/
腳本python3 .grok/skills/video2dsprite/scripts/video2dsprite.py …
影片工具imagine_image_to_video — 動畫化一個基底 file_path(確認存在)
檢查對靜態圖/影格使用 read_file;報告影片路徑
依賴ffmpeg + Pillow + numpy(app-builder 映像中已預裝)
輸出主目錄assets/sprites/video2dsprite/<name>/ 位於 /workspace 下
預設英雄角色請優先使用 generate2dsprite;此為更密集的動作路徑
base still → imagine_image_to_video (in-place motion) → extract frames → chroma key → sample/normalize → strip / grid / GIF

平台閘道(請先閱讀)

執行環境是否支援?
Grok Build (xAI)是 — 需要一個圖片生成器 + 一個圖片轉影片工具
Codex / Claude / 其他代理否 — 它們缺少 Grok 影片工具。請告知使用者此技能僅限 Grok Build,並提供 $generate2dsprite 作為替代

根據能力閘控,而非工具名稱的精確匹配。 圖片生成功能呈現為 imagine_text_to_image / imagine_image_to_image;影片呈現為 imagine_image_to_video 或(舊版)generate_video。請使用你工具清單中有的那一組。僅在你完全沒有圖片轉影片工具時才停止並解釋。不要用程式繪製的影格來偽造動作。

此技能是一個可選的更密集動作路徑。它不取代 $generate2dsprite:

當…時使用 $generate2dsprite當…時使用 $video2dsprite
清晰的像素工作表、固定網格、辨識度關鍵的角色使用者想要更密集的中間姿勢 / 更流暢的循環感
攻擊/施法身體表、道具包、引擎圖集嘗試從影片來源的奔跑/行走/待機動作
大多數遊戲精靈的生產預設使用者明確要求影片 → 影格 → 精靈

影片會柔化像素、偏移角色辨識度,並留下色鍵邊緣。務必進行品質檢查;對於英雄角色,除非使用者想要影片效果,否則請優先使用 $generate2dsprite。

參數

從使用者請求中推斷:

  • subject:角色 / 生物描述,或現有靜態圖的路徑
  • action:run | walk | idle | attack | 自訂動作短語
  • view:通常是 side(橫向卷軸)。topdown 較困難 — 請警告並保持鏡頭鎖定
  • duration:6(預設)或 10 秒
  • frame_counts:要匯出的較密集影格組,預設為 8,16,24,48
  • cell_size:輸出精靈單元格,預設為 128
  • anchor:feet(側面移動的預設值)| center
  • bg:純色 #FF00FF(色鍵所需)
  • name:輸出代號
  • out_dir:工作資料夾(預設為 ./sprites/video2dsprite/<name>/ 或專案相關路徑)

代理規則

  1. 僅限 Grok。 在非 Grok 執行環境中,以簡短說明 + $generate2dsprite 替代方案拒絕。
  2. 靜態圖 → 影片,絕不單獨使用文字生成影片。 先用 imagine_text_to_image(從提示或參考 file_path)將影格 1 建立為乾淨的靜態圖。然後使用該靜態圖的 file_path 呼叫 imagine_image_to_video。
  3. 原地動作。 提示詞要求奔跑/行走原地進行,面向固定方向。無鏡頭平移、無背景滾動、無場景變化。主體大致保持居中。
  4. 基底和影片提示中保留純洋紅色背景(#FF00FF / 純洋紅)。對於洪水填充式色鍵是必需的。
  5. 不要用 PIL/Canvas 憑空創造美術。 基底美術來自 imagine_text_to_image 或使用者/本機靜態圖。腳本僅進行後處理。
  6. 除非使用者要求整合,否則不要將實驗性輸出放入遊戲中。
  7. 遊戲用途優先選擇一個動作循環。 對整個 6 秒多循環片段進行密集取樣以供預覽是可行的;對於引擎工作表,在視覺品質檢查後,可以選擇性地重新取樣單一循環(12–16 影格)。
  8. 完成時報告影片、清理後的影格、條狀圖和預覽 GIF 的絕對路徑。

工作流程

1. 規劃

選擇最小可用的執行:

  • 側視奔跑/行走循環 → 此技能
  • 多動作英雄套件 → 每個動作仍使用 $generate2dsprite;僅在使用者要求時才使用影片進行動作
  • 特效 / 投射物 / 道具包 → $generate2dsprite,非影片

建立:

<out_dir>/
  base/
  video/
  frames-raw/
  frames-clean/
  sprite/          # 預設 8 影格組 + 更密集的 x16/x24/x48
  prompt-used.txt
  pipeline-meta.json
  README.txt

2. 建構基底靜態圖

選項:

  • A. 現有精靈: 讀取圖片,必要時合成到純色 #FF00FF 上,然後將該沙箱路徑傳遞給 imagine_image_to_image / imagine_image_to_video
  • B. 新角色: 使用 imagine_text_to_image 生成,搭配純洋紅色背景、全身、側面視角、居中
  • C. 匹配參考: 使用參考 file_path 進行 imagine_image_to_image,將其移至洋紅色背景上並保留角色辨識度

基底要求:

  • 全身可見,充足的洋紅色邊距
  • 奔跑/行走為側面視角(側面或 3/4 側面),腳部靠近底部三分之一處
  • 當有參考圖時,美術風格與專案其餘部分一致
  • 無文字、UI、浮水印或第二個角色

複製回傳的 file_path 並儲存為 <out_dir>/base/<name>-base.png;為影片呼叫保留基底 file_path。

將確切的圖片提示寫入 prompt-used.txt。

3. 使用 imagine_image_to_video 製作動畫

呼叫 Grok imagine_image_to_video:

  • 來源路徑:<基底靜態圖 file_path>(T2I / I2I 回傳的沙箱路徑)
  • duration:6(預設)或 10
  • resolution_name:480p,除非使用者要求 720p
  • prompt:一個簡短的現在式鏡頭(參見 references/prompt-rules.md)

提示中的強制動作約束:

  • 主體原地奔跑/行走(跑步機風格)
  • 鏡頭鎖定 — 無平移、縮放或環繞
  • 背景保持純色平面洋紅
  • 在整個鏡頭中,角色辨識度、服裝、調色板保持穩定
  • 僅限單一連續動作

將回傳的影片 file_path 複製到 <out_dir>/video/<name>-<duration>s.mp4。

如果影片工具不可用,則停止(平台閘道)。

4. 萃取 + 色鍵 + 取樣(本機腳本)

執行處理器(ffmpeg + Pillow + numpy):

python3 .grok/skills/video2dsprite/scripts/video2dsprite.py process \
  --video <out_dir>/video/<name>-6s.mp4 \
  --out-dir <out_dir> \
  --name <name> \
  --frame-counts 8,16,24,48 \
  --cell-size 128 \
  --body-height 100 \
  --foot-y 118 \
  --fps 0

備註:

  • --fps 0 = 萃取每個解碼影格(使用來源幀率)
  • 從角落進行洋紅色洪水填充 + 去色偏
  • 對 --frame-counts 中的每個計數進行均勻取樣
  • 腳部正規化的單元格、水平條狀圖、網格、每個計數的循環 GIF

可選:僅從現有已清理的影格重新取樣更密集的組合:

python3 .grok/skills/video2dsprite/scripts/video2dsprite.py sample \
  --clean-dir <out_dir>/frames-clean \
  --out-dir <out_dir> \
  --frame-counts 16,24,48 \
  --cell-size 128

5. 品質檢查

視覺檢查:

  • 預覽 GIF 循環沒有明顯跳動
  • 洋紅色已去除(無純粉紅區塊);邊緣殘留可接受,或重新進行色鍵
  • 腳部保持在穩定的基準線上(無因不當裁切造成的跳躍)
  • 角色辨識度大致穩定(臉部/服裝未在每個影格中變形)
  • 動作是原地進行(未滑出畫面)
  • 遊戲用途:選擇一個計數(通常是 16 或 24)或擷取一個真實循環

如果角色辨識度嚴重偏移或像素過於模糊,請退回到 $generate2dsprite 以製作生產工作表,並將影片組合僅保留作為動作參考。

6. 交付

僅報告路徑(除非使用者要求連接到遊戲中):

  • 影片:video/*.mp4
  • 密集精靈:sprite/x16|x24|x48/
  • 條狀圖 / 網格 / GIF:sprite/run-strip-N.png、run-grid-N.png、run-preview-N.gif
  • 元資料:pipeline-meta.json

除非要求,否則不要修改遊戲程式碼。

預設值

  • 持續時間:6 秒
  • 動作:側面原地奔跑,面朝右方
  • 匯出計數:8、16、24、48
  • 單元格:128²,身體高度約 100,腳部在 y≈118
  • 背景:#FF00FF
  • 優先使用單一資產 imagine_image_to_video 而非多參考(如有需要,先用 imagine_text_to_image 合成多參考)

取捨(向使用者說明一次)

優點: 更密集的中間影格 → 通常感覺比 4–8 個離散生成姿勢更流暢。 缺點: 像素較軟、角色辨識度偏移、色鍵邊緣、多循環 6 秒片段非單一完美循環、資產更重。 經驗法則: 8→16→24 通常能獲得流暢度;48 通常邊際效應遞減;145 個原始影格是供取樣用,並非全部用於執行期。

資源

與其他技能的關係

  • $generate2dsprite — 主要工作表管線(Codex + Grok,當存在圖片生成工具時)
  • $generate2dmap — 地圖;此處未使用
  • $video2dsprite — Grok Build 獨佔的動作密集化路徑
  • $game-asset-core / $game-animation-frames — 循環/翻轉測試/動作規則和引擎就緒預設值;沙箱執行仍使用此技能的腳本(洋紅色基底 + 色鍵),而非任意背景顏色

Individual skills in this repo

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

evalix098/tiktoklive

Add user accounts and sign-in to this TanStack Start app. Use when the app needs authentication, sign-in, user accounts, protected routes, or per-user data. Triggers on "auth", "login", "log in", "sign in", "sign up", "account", "users", "authentication", "protected", "who is logged in", "current user", "per-user".

evalix098/tiktoklive

Build browser games and interactive/canvas/3D experiences in this TanStack Start + React app. Use for any game, simulation, or WebGL/Canvas experience — 2D or 3D, single-player. Covers the game loop & timing, 3D orientation/camera conventions, collision, performance, assets, audio, save, game feel, and per-genre playbooks. For WASD / vehicle / flight **input signs and inverted A/D**, open the **`controls`** skill — do not rely on this file or racing-kart alone. Triggers on "game", "minecraft", "fps", "platformer", "racing", "tetris", "snake", "shooter", "3d", "three.js", "canvas", "voxel", "physics".

evalix098/tiktoklive

Player-facing input signs for browser games: WASD, vehicles, flight, FPS mouse-look, and the #1 failure mode (inverted A/D). Mandatory control self-tests and a tiny test interface so you can verify A turns left before shipping. Load for ANY game with movement, steering, flying, driving, tanks, boats, mechs, drones, planes, karts, third-person follow cams — not only racing. Triggers on "controls", "WASD", "inverted", "steer", "flight", "airplane", "kart", "vehicle", "yaw", "roll", "pitch", "mouse look", "A/D".

evalix098/tiktoklive

Design and build polished, non-generic UI for this TanStack Start + React + Tailwind v4 + shadcn/Radix app. Use whenever you create or restyle any interface surface — pages, landing pages, dashboards, forms, modals, nav, and game overlays (start screens, HUD, menus). Covers design tokens, layout, typography, color, spacing, motion, and the anti-"AI-slop" rules that keep output from looking generic. Triggers on "design", "UI", "make it look good", "polish", "landing page", "theme", "style", "redesign", "ugly", "clean up".

evalix098/tiktoklive

Deep guide for game ANIMATION assets: motion cycles, action keyframes, effect sequences, and animation sprite sheets — built around a video-first pipeline. In this app-builder sandbox, execute via the video2dsprite / generate2dsprite skills (magenta + scripts), not ad-hoc ffmpeg. Use whenever generating anything that moves: walk/run cycles, attacks, idles, FX, flags, fire, animation sheets. Complements game-asset-core.

evalix098/tiktoklive

Core discipline for ANY game-asset generation with Imagine tools: the engine-ready defaults users don't state, spec checklists, style anchoring, read-back verification, honest defect flagging. Use whenever generating any game art (sprites, sheets, animations, tiles, UI, FX) — then ALSO load the matching specialist skill: game-animation-frames for anything that moves, game-tilesets for tiles/terrain, game-character-consistency for recurring characters, game-ui-icons for UI and icons.

evalix098/tiktoklive

Deep guide for CHARACTER IDENTITY across images: turnarounds (front/side/ back), state and damage variants, palette swaps, equipment changes, and same-character-in-context sets. Use whenever generating character turnarounds, character sheets, variants of an existing sprite, or any same-subject multi-image set. Complements game-asset-core.

evalix098/tiktoklive

Deep guide for game TILE assets: seamless tileable textures, terrain transition tilesets, autotiles, and ground/platform tiles. Use whenever generating tileable textures, tilesets, terrain transitions, or seamless patterns. Complements game-asset-core.

evalix098/tiktoklive

Deep guide for game UI assets: buttons with interaction states, panels, bars, wordmark logos, and icon sets. Use whenever generating game UI elements, HUD assets, inventory icons, icon sets, buttons, or title logos. Complements game-asset-core.

evalix098/tiktoklive

Generate production-oriented 2D game maps with `imagine_text_to_image`: RPG/top-down maps, side-scroller parallax stages, tilemaps, layered raster maps, prop packs, collision zones, and walkable areas. Use when building browser games that need real map art (not pure code-drawn tiles), layered props, or map collision metadata. Triggers on "map", "level", "stage", "tilemap", "overworld", "dungeon", "side scroller background", "prop pack", "2D map".

evalix098/tiktoklive

Generate and postprocess 2D game sprites and animation sheets: pixel-art characters, NPCs, creatures, spells, projectiles, impacts, props, summons, and transparent PNG/GIF exports. Use when building browser games that need real sprite sheets (not code-drawn placeholders), matching a map art style, or producing magenta-background sheets for chroma-key cleanup. Triggers on "sprite", "sprite sheet", "animation sheet", "pixel art character", "walk cycle", "attack animation", "projectile sprite", "2D game asset".

evalix098/tiktoklive

How to use the Imagine tools in Grok Build: imagine_text_to_image, imagine_image_to_image, imagine_reference_to_image, imagine_text_to_video, imagine_image_to_video, imagine_reference_to_video, and render_file for chat previews. When to build a visual with code instead of generating it, prompt-craft, reference-first handling of real people, factual grounding, and asset-consistency. Load this whenever generating or editing an image or video is on the table. Tool-usage-driven, not triggered by a user merely mentioning images.

evalix098/tiktoklive

Peer-to-peer realtime multiplayer over WebRTC data channels: every user of the deployed app connects directly to every other user (full mesh), the server only brokers the handshake at /api/rtc. Lowest possible latency, zero per-message server cost. Use for 2-8 player co-op/casual realtime: shared cursors, drawing, party games, casual action. Triggers: p2p, peer to peer, webrtc, low latency multiplayer, direct connection.

evalix098/tiktoklive

Use Neon Postgres (the database) in this TanStack Start app. Use when the app needs to store or query data, persist state, or keep per-user data. Triggers on "database", "Postgres", "Neon", "save data", "store data", "persist", "tables", "SQL", "query", "migrations".

evalix098/tiktoklive

Share-link previews and app identity for apps on *.grok.me: the injector-owned og:image card, the SVG favicon, and PWA icons for installable apps. Use when scaffolding, renaming, or restyling the app — and for share / unfurl / OG / Twitter card questions. A custom 1200×630 card from the app's own art is the default — games of every kind (DOM board/word games included), whimsical apps, creative tools, and brand-forward pages; only plain utilities keep the placeholder. Always run the brand-asset pass as a `task` subagent and never wait for it. Triggers on "share", "rename", "app name", "OG", "Open Graph", "twitter card", "unfurl", "og:image", "og:type", "x:game:image", "x-banner", "link preview", "social card", "thumbnail", "preview image", "favicon", "app icon", "PWA", "manifest", "installable", "home screen", "SEO", "meta description".

evalix098/tiktoklive

Official Three.js API and TSL (Three.js Shading Language) reference for LLM code generation. Load when writing or debugging three.js / WebGL / WebGPU / custom materials / shaders / GLTF / advanced three APIs beyond basic game loop/controls. Prefer building-games for game correctness (loop, WASD, camera, orientation); use this skill for full API/TSL depth. Triggers on "three.js", "threejs", "WebGPU", "TSL", "NodeMaterial", "shader", "GLTF", "MeshStandard", "OrbitControls", "WebGLRenderer".

evalix098/tiktoklive

Call the xAI API (Grok) from this app's server code using the injected XAI_API_KEY: chat/LLM features, image and video generation (Imagine), and voice (text-to-speech). Use when the app needs any "AI" / "assistant" / "chatbot" / "Grok" functionality, runtime image/video generation, or speech. Triggers on "AI", "LLM", "chatbot", "assistant", "Grok", "xAI", "generate text", "summarize", "generate image", "AI video", "voice", "text to speech", "TTS", "OpenAI" (use xAI instead).

相關技能