bevyengine/bevy
bevy_animation
Skeletal and morph-target animation, the animation graph, and the animation player. Drives any reflectable property — translation, rotation, scale, morph weights, and arbitrary user-defined fields — over time.
Purpose
bevy_animation provides:
AnimationClipasset — a collection of curves keyed by the path of the animated property.AnimationPlayercomponent — the runtime that ticks clips, blends them, and applies the result.AnimationGraph— a graph of nodes that mix and crossfade clips.AnimationTarget— the entity whose properties are animated.- Curve evaluation against the
bevy_reflectpath syntax.
Directory layout
crates/bevy_animation/src/
├── lib.rs # AnimationPlugin
├── animation_player.rs # AnimationPlayer component + tick logic
├── animation_curves.rs # The curves keyed by reflect path
├── animation_event.rs # Triggered events at specific times in clips
├── graph.rs # AnimationGraph & node types
├── transition.rs # Cross-fade transitions
├── animatable.rs # Animatable trait (interpolatable values)
├── gltf_curves.rs # glTF-flavored cubic/Hermite curves
├── prelude.rs
└── …Key abstractions
| Type | File | Description |
|---|---|---|
AnimationClip |
crates/bevy_animation/src/lib.rs |
Asset; map of AnimationPath → curve. |
AnimationPlayer |
crates/bevy_animation/src/animation_player.rs |
Component; ticks an AnimationGraph. |
AnimationGraph |
crates/bevy_animation/src/graph.rs |
Asset; nodes that mix clips. |
AnimationTarget |
crates/bevy_animation/src/lib.rs |
Component on entities whose properties get animated. |
Animatable |
crates/bevy_animation/src/animatable.rs |
Trait for interpolating between two values. |
AnimationEvent |
crates/bevy_animation/src/animation_event.rs |
Trigger events fired at specific times. |
How it works
A glTF model imports as a hierarchy with one entity per skeletal joint. Each joint has an AnimationTarget whose id matches the path stored in the corresponding AnimationClip track. The AnimationPlayer resolves paths at play time, samples the active curve, and writes the result through reflection.
The animation graph is the modern composition primitive. Nodes can be Clip (play one clip), Add (mix), Blend (linear blend), or user-defined. The graph lets you build state machines like "walk → run with crossfade controlled by a parameter" without hardcoding logic in systems.
Integration points
- Depends on:
bevy_app,bevy_ecs,bevy_reflect,bevy_math,bevy_asset,bevy_transform. - Depended on by:
bevy_gltf(when thegltf_animationfeature is on).
Entry points for modification
- Adding an animatable type: implement
Animatablefor it. - New graph node kind: add a variant to the graph node enum in
graph.rsand handle it in the player. - Custom curve format: look at
gltf_curves.rsfor the existing pattern.
See also
bevy_gltf— primary source of animation clips.bevy_math—Curvetrait used internally.bevy_reflect— path-based field access.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.