/bevy-skills:bevy-animationfrom bevy-skills
Wires AnimationPlayer, AnimationGraph, and AnimationTransitions for glTF clips, state-driven blending, AnimationMask, AnimationEvent observers, and procedural tweening with EasingCurve in Bevy 0.20.
Ships in bevy-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
AnimationPlayer + AnimationGraphHandle.AnimationTransitions::play(player, node, Duration).AnimationGraph in code: blend nodes, additive nodes, weights, AnimationMask.#[derive(AnimationEvent)] + clip.add_event_to_target(...) + On<MyEvent> observers.AnimationClip — sampling a Curve per frame via EasingCurve + EaseFunction or CubicSegment::new_bezier_easing.Name requirement for AnimationTargetId::from_name.bevy::math::curve / bevy::math::cubic_splines import errors after upgrading to 0.20.Verified against bevy = "0.20" — cargo check clean in bevy-skills-tester/examples/bevy_animation.rs.
use bevy::{
animation::{
animated_field,
animation_curves::{AnimatableCurve, AnimatableKeyframeCurve},
AnimationEvent, AnimationTargetId,
},
prelude::*,
};
use core::time::Duration;
#[derive(AnimationEvent, Clone)]
struct FootstepEvent { foot: u8 }
fn setup(
mut commands: Commands,
asset_server: Res<AssetServer>,
mut clips: ResMut<Assets<AnimationClip>>,
mut graphs: ResMut<Assets<AnimationGraph>>,
) {
// 1. Load a glTF clip
let walk: Handle<AnimationClip> =
asset_server.load("models/character.glb#Animation0");
// 2. Build a tiny procedural clip with a sample curve + an event
let bone = AnimationTargetId::from_name(&Name::new("Hips"));
let tween = AnimatableKeyframeCurve::new([
(0.0_f32, Vec3::ZERO),
(0.5, Vec3::new(0.0, 1.0, 0.0)),
(1.0, Vec3::ZERO),
]).expect("strictly-increasing times");
let curve = AnimatableCurve::new(animated_field!(Transform::translation), tween);
let mut proc = AnimationClip::default();
proc.add_curve_to_target(bone, curve);
proc.add_event(0.5, FootstepEvent { foot: 0 });
let proc = clips.add(proc);
// 3. Compose a graph: root → walk + additive(proc, mask=group 0 excluded)
const MASK_GROUP_0_BIT: u64 = 1 << 0;
let mut graph = AnimationGraph::new();
let root = graph.root;
let _walk_node = graph.add_clip(walk, 1.0, root);
let additive = graph.add_additive_blend(0.5, root);
let _proc_node = graph.add_clip_with_mask(proc, MASK_GROUP_0_BIT, 1.0, additive);
// 4. Spawn the player entity (bones come from the loaded glTF scene)
commands.spawn((
Name::new("AnimationRoot"),
AnimationPlayer::default(),
AnimationGraphHandle(graphs.add(graph)),
AnimationTransitions::new(),
));
}
fn start(mut q: Query<(&mut AnimationTransitions, &mut AnimationPlayer), Added<AnimationPlayer>>) {
use bevy::animation::{graph::AnimationNodeIndex, RepeatAnimation};
for (mut tx, mut player) in &mut q {
tx.play(&mut player, AnimationNodeIndex::new(1), Duration::from_millis(250))
.set_repeat(RepeatAnimation::Forever);
}
}
fn on_footstep(trigger: On<FootstepEvent>) {
let foot = trigger.foot; // On<E> derefs to &E
let _entity = trigger.trigger().target; // AnimationEventTrigger::target
let _ = foot;
}
fn main() {
App::new()
.add_plugins(DefaultPlugins) // gltf_animation is a default feature
.add_systems(Startup, setup)
.add_systems(Update, start)
.add_observer(on_footstep)
.run();
}
| Topic | Reference |
|---|---|
Building blend / additive graphs, AnimationMask, hot-swap | references/animation-graph.md |
Blender → glTF → Bevy import: Name, axis, multi-clip, morph targets, unsupported extensions | references/gltf-import.md |
Procedural animation in Update vs FixedUpdate, root-motion extraction | references/procedural-animation.md |
Idle / walk / run blending; AnimationTransitions::play + Bevy States integration | references/state-machines.md |
#[derive(AnimationEvent)], add_event_to_target, On<E> observer wiring | references/animation-events.md |
AnimatableCurve, EasingCurve, EaseFunction, cubic-bezier, UnevenSampleAutoCurve | references/curves-and-tweening.md |
AnimationPlayer cost, skin buffers, graph complexity, runtime graph swaps | references/performance.md |
| Principles — Slow In/Out, Timing, Anticipation → easing + duration | references/principles-easing-and-timing.md |
Principles — Squash & Stretch, Arc, Exaggeration → Transform keyframes | references/principles-transform-keyframes.md |
| Principles — Staging, Follow Through, Secondary Action → graph layering + masks | references/principles-graph-layering.md |
| Principles — Straight-Ahead vs Pose-to-Pose, Solid Drawing, Appeal → upstream authoring | references/principles-authoring.md |
The four principles-*.md references group Thomas & Johnston's twelve principles by which Bevy primitive they actually exercise. Quick map:
EaseFunction / EasingCurve / CubicSegment::new_bezier_easing and clip duration + ActiveAnimation::set_speed.AnimatableKeyframeCurve over Transform::scale / ::translation via animated_field!.AnimationGraph::add_additive_blend + AnimationMask group isolation.bevy_curve. bevy::math::curve::{EasingCurve, EaseFunction} and bevy::math::cubic_splines::CubicSegment are now bevy::curve::{EasingCurve, EaseFunction} and bevy::curve::cubic_splines::CubicSegment. bevy::prelude still re-exports them, so most code only needs the use lines fixed. Signatures are unchanged (EasingCurve::new(start, end, ease_fn), CubicSegment::new_bezier_easing(p1, p2)).AnimationTargetId hash algorithm changed. Different joint hierarchies no longer collide. Regenerate any serialized target IDs; IDs computed at runtime with from_name / from_iter are fine.Mesh. GltfAssetLabel::MorphTarget is gone; MeshMorphWeights can reference an entity with MorphWeights instead of being auto-copied. See references/gltf-import.md.On<E> is unchanged for AnimationEvents. Lifecycle observers on bone entities are On<Add<AnimatedBy>>, not On<Add, AnimatedBy>.AnimationTarget { id, player } no longer exists. It's two components on each bone entity: AnimationTargetId(Uuid) + AnimatedBy(Entity). The glTF loader spawns these for you.gltf_animation is on by default. No opt-in needed unless you ran default-features = false.AnimationTransitions::play_with_transition does NOT exist. The only method is play(&mut self, player, node, Duration) -> &mut ActiveAnimation. Chain .set_repeat(RepeatAnimation::Forever) / .set_speed(f32) on the returned value.animated_field! and AnimatableCurve are not in the prelude. Import from bevy::animation::{animated_field, animation_curves::{AnimatableCurve, AnimatableKeyframeCurve}}.On<AnimationEvent> is not an EntityEvent observer. On<E> derefs to &E. The firing entity is trigger.trigger().target (AnimationEventTrigger::target). .target() / .entity are not available.Name is required on bone entities for AnimationTargetId::from_name(&Name) to resolve. The glTF loader sets this; hand-built skeletons must too. Since 0.20 Name::new from &str needs 'static; use String for runtime names.AnimationMask bit polarity. A set bit means that node will not animate targets in that group. Register a bone via graph.add_target_to_mask_group(target_id, group_u32). To restrict a node to one group, set every bit except that group's.PostUpdate inside the AnimationSystems set (a unit set in 0.20), before TransformSystems::Propagate. Procedural systems that also write Transform should run in Update or order explicitly against AnimationSystems.KHR_animation_pointer (still unsupported by bevy_gltf 0.20.1), particles are separate — see references/gltf-import.md.bevy-migration-0-19-to-0-20 — the bevy_curve split and observer generic change in full.bevy-cameras — camera animation (panning, dolly, focus follow) uses the same EaseFunction / EasingCurve toolkit.bevy-core-concepts — Update vs FixedUpdate choice for procedural animation; see procedural-animation.md.bevy-ecs-systems — observer wiring patterns (On<E>, add_observer) used for AnimationEvents.bevy-pbr-materials — material-parameter animation via AnimatableCurve targeting StandardMaterial fields.bevy-custom-assets — AssetLoader patterns if you serialise AnimationGraph to RON and load it as an asset.references/animation-events.md (opens in a new tab)references/animation-graph.md (opens in a new tab)references/curves-and-tweening.md (opens in a new tab)references/gltf-import.md (opens in a new tab)references/performance.md (opens in a new tab)references/principles-authoring.md (opens in a new tab)references/principles-easing-and-timing.md (opens in a new tab)references/principles-graph-layering.md (opens in a new tab)references/principles-transform-keyframes.md (opens in a new tab)references/procedural-animation.md (opens in a new tab)references/state-machines.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub chrisgliddon/bevy-skills --plugin bevy-skills32 skills in this plugin
/bevyUse when starting any Bevy task, choosing between Update and FixedUpdate, picking Cargo feature flags, or recalling which sibling skill covers ECS, assets, rendering, UI, or migration. Routes to the right Bevy 0.20 skill and pins the engine version for downstream snippets./bevy-a11yUse when designing or auditing high-standard video-game accessibility in Bevy 0.20, integrating screen readers and focus navigation, supporting adaptive controllers and complete remapping, implementing captions or audio description, checking contrast and motion safety, or building disabled-player test evidence./bevy-assetsUse when loading with `AssetServer::load` or `AssetServer::load_builder().with_settings(..)`, holding a `Handle<T>`, spawning a glTF scene with `WorldAssetRoot` (`Handle<WorldAsset>`), mutating through `Assets::get_mut` / `AssetMut`, polling `LoadState::is_loaded`, resolving an `AssetPath`, or replacing `AssetId::invalid()` with `Option<AssetId<T>>` in Bevy 0.20.Other plugins' skills for the same job