godot-animation
Skill này làm gì
Skill này giải thích nên dùng công cụ hoạt hình nào trong Godot và cách thiết lập từng công cụ. Nó dành cho nhà phát triển Godot làm hoạt hình cho nhân vật, sprite sheet và phần tử UI.
Khi nào nên dùng
- ✓Khi bạn cần các clip keyframe cho một nhân vật hoặc vật thể trong Godot.
- ✓Khi một nhân vật phải chuyển mượt giữa hoạt hình đi bộ, chạy và đứng yên.
- ✓Khi bạn muốn một hiệu ứng nảy hoặc mờ dần nhanh cho UI bằng code với Tween.
Liên kết skill
https://github.com/gamedev-skills/awesome-gamedev-agent-skills/blob/main/skills/godot/godot-animation/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Tôi muốn nhân vật Godot của mình chuyển mượt giữa các hoạt hình đứng yên, đi bộ và chạy dựa trên tốc độ của nó.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent tạo các clip trong AnimationPlayer, rồi thêm AnimationTree với máy trạng thái hoặc blend space để chọn giữa chúng. Với các hiệu ứng nhanh, nó dùng Tween trong code.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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
- 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 anAnimationPlayerto pull clips from.Tween— fire-and-forget procedural interpolation in code (create_tween()); ideal for UI pops, fades, and one-off moves.
- For 2D sprite sheets: use
AnimatedSprite2D+SpriteFrames, or keyframe theframeproperty in anAnimationPlayer. - For characters: build clips in
AnimationPlayer, then add anAnimationTree(active = true), set itsanim_player, and design anAnimationNodeStateMachineorAnimationNodeBlendSpace2Das the tree root. - Drive transitions from code via the playback object (
travel) or by setting blend parameters. - React to clip events with the
animation_finishedsignal 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.activeleft false → nothing animates andtravel()appears to do nothing. Setactive = trueand assign theanim_playerpath.- 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
AnimationTreeis active, don't also callAnimationPlayer.play()for the same tracks — let the tree own playback. - 3.x Tween node is gone. There is no
Tweennode to add in 4.x; create tweens in code withcreate_tween()(which returns aTween). 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. Useget_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
Containersnaps back → the container resets child transforms whenever it re-sorts. In 4.7+ set `of
Câu hỏi thường gặp
Khác biệt giữa AnimationPlayer và Tween là gì?
AnimationPlayer giữ các clip keyframe đã được tạo sẵn, còn Tween chạy một phép nội suy ngắn trong code.
Nó có bao quát sprite sheet không?
Có. Nó bao quát AnimatedSprite2D với SpriteFrames, hoặc keyframe thuộc tính frame.
Nó có quyết định trạng thái nào được phát không?
Không. Logic chọn trạng thái thuộc về skill chuyển động 2D của Godot.
Chi tiết
Mô tả gốc của tác giả
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.
Độ phổ biến
- Sao GitHub
- 6.6k
- Vị trí xếp hạng
- #13818
- Giấy phép
- Apache-2.0
- Cập nhật
- 28/10/2026
Bình luận
- …
Thêm skill từ kho mã này
router
6.6kGiúp agent của bạn chọn đúng skill phát triển game cho yêu cầu, dựa trên engine bạn dùng và loại công việc cần làm.
ai-behavior-trees-utility-ai
6.6kGiúp agent của bạn xây dựng behavior tree và hệ thống utility AI cho kẻ thù và nhân vật trong game, chọn hành động theo độ ưu tiên và điểm số.
audio-design
6.6kDạy agent cách trộn âm thanh game: bus, âm lượng theo decibel, hạ nhạc khi có thoại, nhạc thích ứng và biến thể hiệu ứng âm thanh.
camera-systems
6.6kGiúp agent của bạn xây dựng camera game bám theo mượt, giữ trong phạm vi màn chơi, và xoay quanh hoặc nhìn quanh trong 3D.
Skill tương tự
blender-motion-state-inspection
280kCho phép kiểm tra chi tiết trong hoạt ảnh 3D. Hữu ích để kiểm tra tư thế, chuyển động và độ thẳng hàng của nhân vật trong hoạt ảnh.
manim-video
280kGiúp agent tạo video giải thích hoạt hình. Dùng Manim để tạo biểu đồ và sơ đồ rõ ràng cho các khái niệm kỹ thuật.
remotion-video-creation
280kHướng dẫn agent tạo video bằng React với thư viện Remotion. Bao gồm các thực hành tốt nhất về hoạt ảnh, âm thanh, phụ đề và các yếu tố hình ảnh khác.