Langsung ke konten
Skillpedia
Motion & animasi6.6k ยท #13818

godot-animation

Fungsinya

Skill ini menjelaskan alat animasi Godot mana yang sebaiknya dipakai dan cara menyiapkan masing-masing. Skill ini ditujukan untuk pengembang Godot yang menganimasikan karakter, sprite sheet, dan elemen UI.

Kapan dipakai

  • โœ“Saat Anda memerlukan klip keyframe untuk karakter atau objek di Godot.
  • โœ“Saat karakter harus berpindah halus antara animasi jalan, lari, dan diam.
  • โœ“Saat Anda menginginkan efek pop atau fade UI yang cepat dalam kode menggunakan Tween.

Link skill

https://github.com/gamedev-skills/awesome-gamedev-agent-skills/blob/main/skills/godot/godot-animation/SKILL.md

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/gamedev-skills/awesome-gamedev-agent-skills/blob/main/skills/godot/godot-animation/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit โ†’

Contoh permintaan ke AI

โ€œSaya ingin karakter Godot saya berpindah halus antara animasi diam, jalan, dan lari berdasarkan kecepatannya.โ€

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Agent membuat klip di AnimationPlayer, lalu menambahkan AnimationTree dengan state machine atau blend space yang memilih di antara klip tersebut. Untuk efek cepat, agent memakai Tween dalam kode.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.

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.
  • Tween stalls when its node leaves the tree. node.create_tween() pauses while that node is outside the tree and dies when it is freed. Use get_tree().create_tween() for a tween that must keep running while the node is out of the tree.
  • Scale/rotation tween on a child of a Container snaps back โ†’ the container resets child transforms whenever it re-sorts. In 4.7+ set `of
Pertanyaan umum

Apa perbedaan AnimationPlayer dan Tween?

AnimationPlayer menyimpan klip keyframe yang dibuat, sedangkan Tween menjalankan interpolasi singkat dalam kode.

Apakah mencakup sprite sheet?

Ya. Skill mencakup AnimatedSprite2D dengan SpriteFrames, atau pemberian keyframe pada properti frame.

Apakah ia memutuskan state mana yang dimainkan?

Tidak. Logika yang memilih state termasuk skill gerakan 2D Godot.

Detail

Deskripsi asli dari pembuat

Animate in Godot 4.7 three ways: AnimationPlayer for keyframed clips (incl. Call Method 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.

repo: gamedev-skills/awesome-gamedev-agent-skills

Popularitas

Bintang GitHub
6.6k
Peringkat
#13818
Lisensi
Apache-2.0
Diperbarui
28/10/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • โ€ฆ

Skill lain dari repositori ini

Skill serupa