PluginBench
Skill
Pass
Audit score 90

godot-animation

gamedev-skills/awesome-gamedev-agent-skills

Animate in Godot 4.x with AnimationPlayer clips, AnimationTree state machines, or Tween procedural effects.

What is godot-animation?

Master three animation tools in Godot 4.7: AnimationPlayer for keyframed clips with call/signal tracks, AnimationTree for blending character states and transitions via state machines, and Tween for code-driven UI/object tweens. Use this when working with animation nodes in scenes or driving animations from code.

  • Author and play keyframed animation clips with AnimationPlayer, including transforms, properties, method calls, and audio tracks
  • Blend and transition between animations at runtime using AnimationTree with state machines and blend spaces
  • Drive procedural tweens in code with create_tween() for UI pops, fades, and one-off object movements
  • React to animation events via animation_finished signals and call/method tracks
  • Animate sprite sheets using AnimatedSprite2D or by keyframing frame properties in AnimationPlayer

How to install godot-animation

npx skills add https://github.com/gamedev-skills/awesome-gamedev-agent-skills --skill godot-animation
Prerequisites
  • Godot 4.7 or compatible 4.x version installed
  • Basic familiarity with Godot scene structure and GDScript
  • An AnimationPlayer node in your scene for clip authoring (required for AnimationTree)
Claude Code
Cursor
Windsurf
Cline

How to use godot-animation

  1. 1.Create an AnimationPlayer node and author keyframed clips in the Animation panel, setting transforms, properties, and call tracks as needed
  2. 2.For character animation, add an AnimationTree node as a sibling, set its anim_player property to point to your AnimationPlayer, and design an AnimationNodeStateMachine or AnimationNodeBlendSpace2D as the tree root
  3. 3.Set AnimationTree.active = true in code to enable the tree; use tree.get('parameters/playback').travel(state) to transition between states in a state machine
  4. 4.For blend spaces, set blend parameters via tree.set('parameters/NodeName/blend_position', value) to interpolate between animations
  5. 5.For UI tweens, call create_tween() in code and chain tween_property() calls with easing and duration; use set_parallel(true) to run multiple tweens simultaneously

Use cases

Good for
  • Building a character controller that transitions between idle, walk, and run states using an AnimationTree state machine
  • Creating a UI pop-in effect by tweening scale and opacity with create_tween()
  • Playing a multi-frame attack animation in AnimationPlayer and awaiting its completion before resuming idle
  • Blending directional movement animations in a 2D blend space based on input direction
  • Triggering sound effects or game logic via call tracks embedded in keyframed animation clips
Who it's for
  • Game developers building 2D or 3D character animations in Godot 4.x
  • UI/UX designers implementing animated transitions and effects
  • Gameplay programmers driving state-based character behavior
  • Anyone authoring sprite-sheet or skeletal animations in Godot

godot-animation FAQ

When should I use AnimationPlayer vs. AnimationTree vs. Tween?

Use AnimationPlayer to author and store keyframed clips. Use AnimationTree to blend and transition between those clips at runtime with state machines or blend spaces. Use Tween for short, procedural animations in code (UI effects, one-off moves) that don't need complex state logic.

Why isn't my AnimationTree playing anything?

Ensure AnimationTree.active is set to true and the anim_player property points to your AnimationPlayer node. Also verify that parameter paths match exactly (e.g., 'parameters/playback' for a state machine root) — typos silently fail.

How do I transition between animation states?

Get the playback object from the AnimationTree (tree.get('parameters/playback')) and call travel(state_name) to move between states defined in your AnimationNodeStateMachine. The tree will handle blending and transitions automatically.

Can I await an animation to finish?

Yes. Use await anim.animation_finished after calling anim.play(clip_name). In Godot 4.x, yield is replaced by await.

How do I tween a sub-property like just the alpha channel?

Use a colon in the property path: tween_property(node, 'modulate:a', 1.0, duration). This tweens only the alpha without overwriting other modulate components.

Full instructions (SKILL.md)

Source of truth, from gamedev-skills/awesome-gamedev-agent-skills.


name: godot-animation description: > Animate in Godot 4.7 three ways: AnimationPlayer for keyframed clips (incl. call and signal tracks), AnimationTree with state machines and blend spaces for character animation, and Tween for short procedural/UI tweens via create_tween(). Use when working with AnimationPlayer/AnimationTree nodes in a .tscn, blending character states, sprite-sheet animation, or code-driven Tweens.

Godot Animation (4.x)

Choose and drive the right animation tool: AnimationPlayer (clips), AnimationTree (blending/state machines), or Tween (short procedural moves). Targets Godot 4.7.

When to use

  • Use when playing keyframed animations, blending walk/run/idle states, animating a sprite sheet, or tweening UI/objects in code.

When not to use: the movement logic that decides which state to play → godot-2d-movement; UI layout (vs. UI tweening) → godot-ui-control; shader-driven effects → godot-shaders.

Core workflow

  1. Pick the tool:
    • AnimationPlayer — author keyframed clips (transforms, properties, method calls, audio, even other animations). The source of truth for clip data.
    • AnimationTree — blend and transition between those clips at runtime with a state machine and/or blend spaces. Needs an AnimationPlayer to pull clips from.
    • Tween — fire-and-forget procedural interpolation in code (create_tween()); ideal for UI pops, fades, and one-off moves.
  2. For 2D sprite sheets: use AnimatedSprite2D + SpriteFrames, or keyframe the frame property in an AnimationPlayer.
  3. For characters: build clips in AnimationPlayer, then add an AnimationTree (active = true), set its anim_player, and design an AnimationNodeStateMachine or AnimationNodeBlendSpace2D as the tree root.
  4. Drive transitions from code via the playback object (travel) or by setting blend parameters.
  5. React to clip events with the animation_finished signal and call/method tracks.

Patterns

1. AnimationPlayer: play a clip and await it

@onready var anim: AnimationPlayer = $AnimationPlayer

func attack() -> void:
    anim.play("attack")
    await anim.animation_finished     # resume after the clip ends
    anim.play("idle")

2. AnimationTree state machine: travel between states

@onready var tree: AnimationTree = $AnimationTree

func _ready() -> void:
    tree.active = true                # the tree drives animation; AnimationPlayer is the source

func set_state(state: StringName) -> void:
    # The playback object controls an AnimationNodeStateMachine root.
    var sm: AnimationNodeStateMachinePlayback = tree.get("parameters/playback")
    sm.travel(state)                  # transitions using the graph's connections

func _physics_process(_d: float) -> void:
    set_state(&"run" if velocity.length() > 5.0 else &"idle")

3. Blend space: blend run direction by a 2D parameter

# Root is an AnimationNodeBlendSpace2D named "Move" with idle/run points placed in it.
func update_locomotion(input_dir: Vector2) -> void:
    # Parameter path = "parameters/<node name>/blend_position".
    tree.set("parameters/Move/blend_position", input_dir)

4. Tween: fade and scale a UI element (code-driven)

func pop_in(node: Control) -> void:
    node.scale = Vector2.ZERO
    node.modulate.a = 0.0
    var tw := create_tween()                          # bound to this node's tree
    tw.set_parallel(true)                             # run the two tweens together
    tw.tween_property(node, "scale", Vector2.ONE, 0.2) \
      .set_trans(Tween.TRANS_BACK).set_ease(Tween.EASE_OUT)
    tw.tween_property(node, "modulate:a", 1.0, 0.2)   # sub-property via ":"

Pitfalls

  • AnimationTree.active left false → nothing animates and travel() appears to do nothing. Set active = true and assign the anim_player path.
  • Wrong parameter path. Blend/condition paths are "parameters/<NodeName>/..." and must match the node names in the tree exactly (e.g. "parameters/playback", "parameters/Move/blend_position"). A typo silently no-ops.
  • AnimationPlayer and AnimationTree fighting. When an AnimationTree is active, don't also call AnimationPlayer.play() for the same tracks — let the tree own playback.
  • 3.x Tween node is gone. There is no Tween node to add in 4.x; create tweens in code with create_tween() (which returns a Tween). They auto-start and free themselves.
  • Reusing a finished tween. A tween is one-shot; call create_tween() again for a new animation. Use set_loops() for repetition.
  • yield/yield(anim, "...") is gone. Use await anim.animation_finished.
  • Sub-property tweens use a colon: "modulate:a", "position:x". Tweening the whole property instead overwrites siblings.

References

  • For state machine transitions/conditions, root motion, one-shot/blend nodes, method & call tracks, SpriteFrames/AnimatedSprite2D, and Tween easing/chaining/callbacks, read references/animation-tree-and-tween.md.

Related skills

  • godot-2d-movement — supplies the velocity/state that selects animations.
  • godot-ui-control — UI that Tweens animate.
  • godot-3d-essentials — 3D character scenes driven by AnimationTree.
  • game-ai — state machines that mirror animation states.