Sprite Animationのロゴ

Sprite Animation

コミュニティ
danicat
sprite-animation

2D sprite sheet management, frame animation sequencing, and Aseprite integration guide for games. Covers sprite grid slicing, animation state machines (idle, walk, attack, death), frame duration timing, tag loops, and Go animation controllers in Ebitengine. Activate when slicing sprite sheets, configuring character animations, integrating Aseprite files (.ase/.aseprite), or writing game animation controllers.

概要

公開者danicat
リポジトリskills
スキル名sprite-animation
スター
24
フォーク
4
同梱ファイル
4
ライセンスApache-2.0
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 4個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    danicatがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキルSprite AnimationをTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/danicat/skills/tree/main/game-dev/sprite-animation
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/danicat/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/game-dev/sprite-animation .claude/skills/sprite-animation
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでSprite Animationを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあると、モデルが自動的にSprite Animationを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Sprite Animationは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、未使用のスキルにはコストがかかりません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

2D Sprite Animation & Aseprite Integration Guide (Animator Role)

This skill equips AI agents acting in the Animator Agent Role with the specifications, deterministic CLI slicing tools, and fail-fast Ebitengine v2 Go controllers required to design, validate, slice, and manage 2D character sprite sheets, animation frame sequences, tag loops, and Aseprite files (.ase / .aseprite / .json).


1. Animator Agent Role & Core Responsibilities

In a game development workflow, the Animator Agent owns all 2D sprite animation pipelines:

  1. Fail-Fast Asset Validation & Grid Slicing: Validates sprite sheet images using file / mimetype and scripts/slice_spritesheet.py to verify binary integrity and exact frame grid divisibility before loading.
  2. Animation Tag & State Specification: Defines animation tags (idle, walk, run, attack, hurt, death, cast), positive frame durations (40ms–200ms), and loop modes (LoopForward, LoopReverse, LoopPingPong, LoopOnce).
  3. Zero-Allocation Frame Pre-Slicing: Pre-slices all ebiten.Image.SubImage frame references at load time (NewGridSpriteSheet) and reuses a persistent ebiten.DrawImageOptions field (ac.drawOp) so Draw() performs zero heap allocations.
  4. Fail-Fast State Transitions: Rejects corrupt sprite sheet dimensions, non-positive frame durations, out-of-bounds tag ranges, and unknown animation tag names with rich fmt.Errorf diagnostics.

2. Technical Reference Standards & Companion Scripts

ModulePathKey Topics Covered
Go Animation Controllerreferences/animation_controller.goFail-fast GridSpriteSheet (load-time SubImage pre-slicing) and zero-allocation AnimationController with delta-time (dt) accumulation and horizontal flipping.
Aseprite Binary Format & GPLreferences/aseprite_format.mdHeader, frame headers, cel chunks (0x2005), tag chunks (0x2018), 9-patch slices (0x2022), GIMP .gpl RGBA palettes, and zero-alloc goaseprite wrapper.
Deterministic Grid Slicer CLIscripts/slice_spritesheet.pyPEP 723 (pillow>=10.0.0) CLI script that validates PNG dimensions against --frame-width / --frame-height, slices grid cells, and exports an Aseprite-compatible JSON manifest + optional frame PNGs.

3. Deterministic Sprite Sheet Validation & Slicing (scripts/slice_spritesheet.py)

Never assume an image is a valid PNG or has evenly divisible grid dimensions based on its filename. Always validate the binary format and run scripts/slice_spritesheet.py:

bash
# 1. Verify actual binary MIME/file type
file assets/sprites/player_sheet.png
# Expected: PNG image data, 256 x 128, 8-bit/color RGBA

# 2. Validate grid divisibility, define animation tags, and export Aseprite JSON manifest
uv run scripts/slice_spritesheet.py assets/sprites/player_sheet.png \
  --frame-width 32 \
  --frame-height 32 \
  --duration-ms 100 \
  --tag idle:0:5:150:forward \
  --tag run:8:15:80:forward \
  --tag attack:16:21:60:forward \
  --tag death:24:31:100:forward \
  --output-json assets/sprites/player_sheet.json \
  --export-frames-dir build/frames/player

If player_sheet.png is not an exact integer multiple of --frame-width and --frame-height, slice_spritesheet.py fails fast with a non-zero exit code and reports the exact pixel remainder to stderr.


4. Animation State Machine Benchmark Table

Animation TagFrame Range / CountFrame DurationLoop ModeGameplay Trigger / Transition
idle4–8 frames120ms–180msLoopForwardDefault state when velocity is zero (VX=0, VY=0).
walk / run8–12 frames60ms–100msLoopForwardActive when moving (VX != 0 or VY != 0).
jump / fall2–4 frames100msLoopOnceTriggered on airborne launch; holds final frame until landing.
attack6–10 frames40ms–80msLoopOnceTriggered on attack action. Invokes OnComplete callback back to idle.
hurt3–5 frames50msLoopOnceTriggered on damage hit alongside Kage hit-flash shader.
death6–10 frames100msLoopOnceTriggered on zero health. Holds final collapse frame without looping.

5. Fail-Fast Integration Patterns in Ebitengine

5.1 Pre-Sliced Grid Sprite Sheet & Controller (references/animation_controller.go)

go
sheet, err := NewGridSpriteSheet(embeddedSpriteImage, 32, 32)
if err != nil {
	return fmt.Errorf("load player sprite sheet: %w", err)
}

controller, err := NewAnimationController(sheet)
if err != nil {
	return fmt.Errorf("init player animation controller: %w", err)
}

if err := controller.AddTag(AnimationTag{
	Name:          "idle",
	StartFrame:    0,
	EndFrame:      5,
	FrameDuration: 150 * time.Millisecond,
	Loop:          LoopForward,
}); err != nil {
	return err
}

if err := controller.AddTag(AnimationTag{
	Name:          "run",
	StartFrame:    8,
	EndFrame:      15,
	FrameDuration: 80 * time.Millisecond,
	Loop:          LoopForward,
}); err != nil {
	return err
}

if err := controller.Play("run"); err != nil {
	return err
}

5.2 Zero-Allocation Update and Draw Usage

go
// In Update():
if err := p.Controller.Update(dt); err != nil {
	return err
}

// In Draw(screen *ebiten.Image):
// Uses pre-sliced sheet.Frames[currentFrame] and persistent controller.drawOp (0 allocs/op)
if err := p.Controller.Draw(screen, p.X, p.Y, p.FacingLeft); err != nil {
	panic(err)
}

6. Animator Agent Pre-Flight Checklist

Before completing animation code or sprite assets:

  • Validated File Format: Verified image using file CLI tool (ensuring valid RGBA PNG and no misnamed JPEG/WebP headers).
  • Grid Math Verified: Verified exact divisibility via scripts/slice_spritesheet.py and NewGridSpriteSheet.
  • All Animation Tags Validated: Checked that StartFrame <= EndFrame < TotalFrames and FrameDuration > 0.
  • Pre-Sliced SubImage Frames at Load Time: Never call SubImage or allocate ebiten.DrawImageOptions inside Draw().
  • Horizontal Flipping Handled: Configured negative matrix scale (Scale(-1, 1) + Translate(FrameWidth, 0)) for left-facing orientation without duplicating sprite sheets.

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「Sprite Animation」では何ができますか?

2D sprite sheet management, frame animation sequencing, and Aseprite integration guide for games. Covers sprite grid slicing, animation state machines (idle, walk, attack, death), frame duration timing, tag loops, and Go animation controllers in Ebitengine. Activate when slicing sprite sheets, configuring character animations, integrating Aseprite files (.ase/.aseprite), or writing game animation controllers.

TypingMindでSprite Animationを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Sprite Animationはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにSprite Animationをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/danicat/skills/tree/main/game-dev/sprite-animationを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Sprite Animationを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストが合致したときにこのスキルを読み込めます。

Sprite Animationは何個のAIモデルで使えますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもSprite Animationを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Sprite Animation」は無料ですか?

はい。danicatがGitHubでApache-2.0ライセンスの下で公開しています。支払いが必要なのは、利用したトークンに対する、ご自身が契約するAIプロバイダーへの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇