
Bevy 2d Animation
Bevy ECS skill for 2D sprite animation.
Install
npx skills add thedivergentai/Game-Dev-Agentic-Skills --skill bevy-2d-animation -g -a claude-code -y- Repository
- thedivergentai/Game-Dev-Agentic-Skills917
- Category
- Design
- Updated
- 19d ago
- License
- LGPL-3.0
- Context cost
- Mediumabout 2,336 tokens
- Runs scripts
- No, instructions only
What it does
Bevy ECS skill for 2D sprite animation. Keywords: Bevy, sprite, animation, AnimationPlayer, AnimationClip, 2D.
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.AnimationPlayerandAnimationTargetId/AnimatedBy(bevy::animation) link a clip to that entity. - Resources: clip assets are
AnimationCliphandles, not a global player. - Systems:
advance_animationsandanimate_targetsare 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_imageandTextureAtlas. Clip curves useanimated_field!plusAnimatableCurve. - A cutout limb is an entity with
AnimationTargetIdandAnimatedBypointing at the entity that ownsAnimationPlayer.
Examples
Atlas frame on a sprite. TextureAtlas.index is the cell.
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,
},
));
}


