# Bevy 2d Animation

Bevy ECS skill for 2D sprite animation.

- Repository: https://github.com/thedivergentai/Game-Dev-Agentic-Skills (917 stars)
- Category: Design
- License: LGPL-3.0
- Last updated: 2026-10-16
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add thedivergentai/Game-Dev-Agentic-Skills --skill bevy-2d-animation -g -a claude-code -y`
Codex: `npx skills add thedivergentai/Game-Dev-Agentic-Skills --skill bevy-2d-animation -g -a codex -y`
Cursor: `npx skills add thedivergentai/Game-Dev-Agentic-Skills --skill bevy-2d-animation -g -a cursor -y`
Gemini CLI: `npx skills add thedivergentai/Game-Dev-Agentic-Skills --skill bevy-2d-animation -g -a gemini-cli -y`

## Description

Bevy ECS skill for 2D sprite animation. Keywords: Bevy, sprite, animation, AnimationPlayer, AnimationClip, 2D.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Bevy 2D animation

## When to use

Load this when a 2D actor needs clip playback on a sprite entity. Pair with bevy-animation for the player and clip types. Pair with bevy-animation-graph when clips must blend.

## ECS shape

- **Components:** `Sprite` (bevy::sprite) on the visible entity. `AnimationPlayer` and `AnimationTargetId` / `AnimatedBy` (bevy::animation) link a clip to that entity.
- **Resources:** clip assets are `AnimationClip` handles, not a global player.
- **Systems:** `advance_animations` and `animate_targets` are the engine systems named on the animation page. Gameplay code should not reimplement them.
- **Schedule:** those systems are engine-owned. Gameplay that reacts to a finished clip chains after them.

## Playback choices

| Need | Bevy idiom |
| --- | --- |
| Frame cells | `Sprite` with `texture_atlas: Some(TextureAtlas { .. })`, or an `AnimationClip` curve. |
| Named cutout limb | `AnimationTargetId::from_name` / `from_names` selects which entity a curve writes. |
| Loop | `ActiveAnimation::repeat` sets `RepeatAnimation::Forever`. |

## Scope

- Frame sheets use `Sprite::from_atlas_image` and `TextureAtlas`. Clip curves use `animated_field!` plus `AnimatableCurve`.
- A cutout limb is an entity with `AnimationTargetId` and `AnimatedBy` pointing at the entity that owns `AnimationPlayer`.

## Examples

Atlas frame on a sprite. `TextureAtlas.index` is the cell.

```rust
fn spawn_sheet(
    mut commands: Commands,
    assets: Res<AssetServer>,
    mut layouts: ResMut<Assets<TextureAtlasLayout>>,
) {
    let layout = TextureAtlasLayout::from_grid(UVec2::splat(32), 4, 1, None, None);
    let layout = layouts.add(layout);
    let image = assets.load("actor.png");
    commands.spawn((
        Sprite::from_atlas_image(image, TextureAtlas { layout, index: 0 }),
        FrameClock {
            timer: Timer::from_seconds(0.12, TimerMode::Repeating),
            frames: 4,
        },
    ));
}

The rest: https://github.com/thedivergentai/Game-Dev-Agentic-Skills/blob/HEAD/skills/bevy-2d-animation/SKILL.md
