Godot 2d animation

From thedivergentai/GD-Agentic-Skills · View interactive version

Godot 2d animation is an AI agent skill from the GitHub repository thedivergentai/GD-Agentic-Skills. Expert patterns for 2D animation in Godot using AnimatedSprite2D and skeletal cutout rigs. Use when implementing sprite frame animations, procedural animation (squash/stretch), cutout bone hierarchies, or frame-perfect timing systems. Trigger keywords: AnimatedSprite2D, SpriteFrames, animation_finis

How to use this skill

Skill file

NEVER Do


Available Scripts

MANDATORY: Read the script for the pattern you are implementing. Inline recipes that duplicated these scripts were removed — the script is the source of truth.

Do NOT Load (by scenario)

| Scenario | Load | Do NOT Load |

|----------|------|-------------|

| Single character / player | one_frame_sync_fix.gd, animation_state_sync.gd, optional animation_tree_step.gd / tween_lifecycle_manager.gd | multimesh_swarm_anim.gd, gpu_mesh_optimizer.gd (unless fill-rate profiling demands it) |

| Frame events / hitboxes / SFX sync | animation_sync.gd (+ AnimationPlayer method tracks) | Swarm/MultiMesh scripts |

| Squash/stretch game-feel | MANDATORY procedural_squash_stretch.gd | Inline landing-condition snippets in this skill |

| Cutout / IK limbs | skeleton_2d_rig_helper.gd | MultiMesh swarm scripts |

| Shader flash / dissolve on anim | shader_hook.gd | — |

| Thousands of bats/fish/props | multimesh_swarm_anim.gd (+ docs fish tutorial) | Per-entity AnimatedSprite2D / Tween managers |

Script index


Expert Decision Tree: Choosing the Right Animation Tool

| Scenario | Recommended Node | Expert Insight |

|----------|------------------|----------------|

| Isolated, pure frame-by-frame spritesheets | AnimatedSprite2D | Cannot animate non-visual properties or method tracks — escalate to AnimationPlayer when you need those. |

| Cutout animations, non-visual sync, audio/particles | AnimationPlayer | Owns transforms, mesh deformation, method/value tracks. |

| Complex state machines, blending, locomotion | AnimationTree | Logic graph over an AnimationPlayer; use travel() via animation_tree_step.gd. |

| Procedural, dynamic, fire-and-forget UI/fx | Tween | Runtime targets; always go through tween_lifecycle_manager.gd. |

| Swarms of thousands of entities | MultiMeshInstance2D + Shader | Load multimesh_swarm_anim.gd only; skip character sync scripts. |


Golden Path: One-Frame Sync (`play` + `advance(0)`)

When changing animation and sprite properties in the same frame, play() alone applies next process tick — one-frame glitch.

MANDATORY: Read one_frame_sync_fix.gd. Minimal contract:

# After any play() that must match flip/modulate/etc. this frame:
anim.flip_h = dir < 0
anim.play(&"run")
anim.advance(0)  # force pose now

Related: animation_looped (loops) vs animation_finished (one-shots); use set_frame_and_progress when swapping skins mid-clip (see AnimatedSprite2D class docs).


Procedural Squash & Stretch

Do NOT paste landing snippets into agents. A prior body used an impossible condition (not is_on_floor() and is_on_floor()).

MANDATORY sole source: procedural_squash_stretch.gd — impact squash, velocity stretch, lerp recovery. Pair with godot-characterbody-2d / godot-2d-physics for floor/velocity authority.


Quick routing (scripts own the recipes)

Expert insights (WHY — keep in body)

Deep recipes (on demand)

| Topic | Reference / script |

|-------|-------------------|

| Signals / frame events / skin swap | signals-and-frame-events.md |

| Cutout rigs / procedural IK feet | cutout-and-skeletal.md |

| GPU mesh / swarms / memory streaming | expert-techniques.md |

| Frame metadata / spawn offsets | animation_data_extractor.gd |

| Async SpriteFrames VRAM | sprite_sheet_memory_manager.gd |

Reference

Progressive disclosure: open Official Documentation links only when researching a specific API;

load Related Skills when routing work to a peer domain — do not preload the whole lattice.

Official Documentation

Related Skills

Prerequisites
Complements
Downstream / consumers
Master
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.