Communitygithub.com

Blender Animation

Anima objetos e personagens 3D no Blender com Python. Use quando o usuário quiser criar quadros-chave de propriedades, criar armaduras e rigs, configurar cadeias IK/FK, animar shape keys para animação facial, editar F-Curves, usar o editor NLA para combinar ações, adicionar drivers para animação baseada em expressões ou programar qualquer fluxo de trabalho de animação no Blender.

O que é Blender Animation?

A habilidade Blender Animation permite que agentes de IA controlem e automatizem a animação de objetos 3D diretamente do terminal, usando a API Python do Blender (bpy). Ela cria quadros-chave para transformações de objetos e ossos, constrói armaduras com rigs IK/FK, anima shape keys para expressões faciais, edita F-Curves para controle de timing, combina ações no editor NLA e usa drivers para automação baseada em expressões matemáticas. Suporta qualquer versão do Blender com suporte a scripting Python e é útil para artistas técnicos, desenvolvedores de jogos e animadores que desejam automatizar tarefas repetitivas, criar ciclos de caminhada, animações de física (como bolas quicando) ou rigs de personagens complexos. O código é executado no console Python integrado do Blender (Shift+F4) ou em scripts .py, e inclui exemplos completos de animação de bola quicando com squash e stretch, e um rig de braço com IK alcançando um objeto.

Funciona com~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/TerminalSkills/skills/tree/HEAD/skills/blender-animation

Perguntar na sua IA favorita

Abre um novo chat com esta habilidade de agente já pré-carregada.

Documentação

Animação no Blender

Visão Geral

Crie e controle animações no Blender usando Python. Crie quadros-chave de transformações de objetos e ossos, construa armaduras com rigs IK/FK, anime shape keys para movimento facial, edite F-Curves para controle de tempo, sobreponha ações no editor NLA e configure drivers para automação baseada em expressões — tudo programável a partir do terminal.

Instruções

1. Quadros-chave de propriedades de objetos

import bpy

obj = bpy.data.objects["Cube"]
# Quadro-chave de localização em vários quadros
for loc, frame in [((0,0,0), 1), ((5,0,3), 30), ((5,4,0), 60)]:
    obj.location = loc
    obj.keyframe_insert(data_path="location", frame=frame)

# Também funciona para rotation_euler, scale, eixo único (index=2 para Z), propriedades personalizadas
obj.rotation_euler = (0, 0, 3.14159)
obj.keyframe_insert(data_path="rotation_euler", frame=60)
obj.scale = (2, 2, 2)
obj.keyframe_insert(data_path="scale", frame=60)
obj["intensity"] = 1.0  # propriedade personalizada
obj.keyframe_insert(data_path='["intensity"]', frame=30)
bpy.context.scene.frame_start, bpy.context.scene.frame_end = 1, 60

2. Controle de interpolação e modificadores de F-Curve

import bpy

action = bpy.data.objects["Cube"].animation_data.action
for fcurve in action.fcurves:
    for kp in fcurve.keyframe_points:
        kp.interpolation = 'BEZIER'  # CONSTANT, LINEAR, BEZIER, SINE, EXPO, BOUNCE, ELASTIC
        kp.easing = 'EASE_IN_OUT'   # AUTO, EASE_IN, EASE_OUT, EASE_IN_OUT
    # Modificador Cycles para loop da animação
    mod = fcurve.modifiers.new(type='CYCLES')
    mod.mode_before = 'REPEAT'       # NONE, REPEAT, REPEAT_OFFSET, MIRROR
    mod.mode_after = 'REPEAT'

# Adicionar ruído a um canal específico
z_curve = action.fcurves.find("location", index=2)  # Localização Z
if z_curve:
    noise = z_curve.modifiers.new(type='NOISE')
    noise.strength, noise.scale = 0.3, 5.0

3. Criar armaduras e ossos

import bpy

arm_data = bpy.data.armatures.new("Rig")
arm_obj = bpy.data.objects.new("Rig", arm_data)
bpy.context.collection.objects.link(arm_obj)
bpy.context.view_layer.objects.active = arm_obj
bpy.ops.object.mode_set(mode='EDIT')
# (nome, head, tail, nome_pai, conectado)
definicoes_osso = [
    ("Spine",      (0,0,1.0),   (0,0,1.4),   None,       False),
    ("Chest",      (0,0,1.4),   (0,0,1.8),   "Spine",    False),
    ("UpperArm.L", (0.2,0,1.7), (0.5,0,1.4), "Chest",    False),
    ("Forearm.L",  (0.5,0,1.4), (0.8,0,1.1), "UpperArm.L", True),
    ("Thigh.L",    (0.1,0,1.0), (0.1,0,0.5), "Spine",    False),
    ("Shin.L",     (0.1,0,0.5), (0.1,0,0.05),"Thigh.L",  True),
]
for nome, head, tail, pai, conectado in definicoes_osso:
    b = arm_data.edit_bones.new(nome)
    b.head, b.tail = head, tail
    if pai:
        b.parent = arm_data.edit_bones[pai]
        b.use_connect = conectado

bpy.ops.object.mode_set(mode='OBJECT')

4. Configurar restrições em ossos

import bpy

arm_obj = bpy.data.objects["Rig"]
bpy.context.view_layer.objects.active = arm_obj
bpy.ops.object.mode_set(mode='POSE')
# IK — usa um Empty como alvo, chain_count limita os ossos afetados
ik = arm_obj.pose.bones["Forearm.L"].constraints.new('IK')
ik.target = bpy.data.objects["IK_Target"]
ik.pole_target = bpy.data.objects["IK_Pole"]
ik.chain_count = 2

# Copy Rotation — espelha a rotação de outro objeto
cr = arm_obj.pose.bones["Chest"].constraints.new('COPY_ROTATION')
cr.target = bpy.data.objects["ChestCtrl"]
# Outros tipos: LIMIT_ROTATION, DAMPED_TRACK, STRETCH_TO, COPY_LOCATION, TRACK_TO

bpy.ops.object.mode_set(mode='OBJECT')

5. Quadros-chave de poses de ossos

import bpy, math

arm_obj = bpy.data.objects["Rig"]
bpy.context.view_layer.objects.active = arm_obj
bpy.ops.object.mode_set(mode='POSE')
if not arm_obj.animation_data:
    arm_obj.animation_data_create()
action = bpy.data.actions.new("WalkCycle")
arm_obj.animation_data.action = action

# Quadro-chave de balanço da coxa: trás → neutro → frente
thigh = arm_obj.pose.bones["Thigh.L"]
for angulo, frame in [(-30, 1), (0, 13), (30, 25)]:
    thigh.rotation_euler = (math.radians(angulo), 0, 0)
    thigh.keyframe_insert(data_path="rotation_euler", frame=frame)

bpy.ops.object.mode_set(mode='OBJECT')

6. Criar e animar shape keys

import bpy

obj = bpy.data.objects["Head"]
mesh = obj.data
if not mesh.shape_keys:  # Chave Basis necessária primeiro
    obj.shape_key_add(name="Basis", from_mix=False)

smile = obj.shape_key_add(name="Smile", from_mix=False)
for i, vert in enumerate(smile.data):
    if i in [42, 43, 56, 57]:  # vértices dos cantos da boca
        vert.co.z += 0.02

# Animar valor da shape key (0.0 → 1.0 → 0.0)
sk = mesh.shape_keys.key_blocks["Smile"]
for val, frame in [(0.0, 1), (1.0, 15), (0.0, 30)]:
    sk.value = val
    sk.keyframe_insert(data_path="value", frame=frame)

7. Sobrepor ações com o editor NLA

import bpy

arm_obj = bpy.data.objects["Rig"]
if not arm_obj.animation_data:
    arm_obj.animation_data_create()
# Empurrar ações como faixas NLA em trilhas separadas
trilha1 = arm_obj.animation_data.nla_tracks.new()
trilha1.name = "Walk"
faixa1 = trilha1.strips.new("Walk", start=1, action=bpy.data.actions["WalkCycle"])
faixa1.repeat = 4                    # repetir 4 vezes
faixa1.blend_type = 'REPLACE'        # REPLACE, COMBINE, ADD, SUBTRACT, MULTIPLY

trilha2 = arm_obj.animation_data.nla_tracks.new()
trilha2.name = "Wave"
faixa2 = trilha2.strips.new("Wave", start=25, action=bpy.data.actions["WaveHand"])
faixa2.blend_type = 'COMBINE'        # misturar sobre a caminhada
faixa2.influence = 0.8               # mistura parcial

arm_obj.animation_data.action = None  # limpar ação ativa para que NLA assuma

8. Adicionar drivers para animação baseada em expressões

import bpy

driver = bpy.data.objects["Cube"].driver_add("location", 2).driver  # dirigir localização Z
driver.type = 'SCRIPTED'
driver.expression = "sin(frame * 0.1) * 2"
# Adicionar uma variável que lê a transformação de outro objeto
var = driver.variables.new()
var.name = "ctrl"
var.type = 'TRANSFORMS'
var.targets[0].id = bpy.data.objects["Controller"]
var.targets[0].transform_type = 'LOC_X'
var.targets[0].transform_space = 'WORLD_SPACE'
driver.expression = "ctrl * 3"  # também funciona em shape keys via sk.driver_add("value")

Exemplos

Exemplo 1: Bola quicando com squash e stretch

Solicitação do usuário: "Animar uma bola quicando com squash e stretch"

import bpy

bpy.ops.object.select_all(action='SELECT')
bpy.ops.object.delete()
bpy.ops.mesh.primitive_uv_sphere_add(radius=0.5, location=(0, 0, 3))
bola = bpy.context.active_object
bola.name = "BouncingBall"

quadros_chave = [  # (frame, z_pos, scale_x, scale_y, scale_z)
    (1,  3.0, 1.0, 1.0, 1.0),    (12, 0.5, 1.0, 1.0, 1.0),     # queda
    (15, 0.3, 1.3, 1.3, 0.6),    (18, 0.5, 0.85, 0.85, 1.2),   # squash + stretch
    (30, 2.2, 1.0, 1.0, 1.0),    (42, 0.5, 1.0, 1.0, 1.0),     # ápice + segunda queda
    (45, 0.3, 1.2, 1.2, 0.7),    (55, 1.5, 1.0, 1.0, 1.0),     # quique menor
    (62, 0.5, 1.0, 1.0, 1.0),                                    # estabilizar
]
for frame, z, sx, sy, sz in quadros_chave:
    bola.location = (0, 0, z)
    bola.keyframe_insert(data_path="location", frame=frame)
    bola.scale = (sx, sy, sz)
    bola.keyframe_insert(data_path="scale", frame=frame)

for fc in bola.animation_data.action.fcurves:
    for kp in fc.keyframe_points:
        kp.interpolation = 'BEZIER'

bpy.context.scene.frame_end = 62
bpy.ops.wm.save_as_mainfile(filepath="/tmp/bouncing_ball.blend")

Exemplo 2: Rig de braço com IK alcançando um objeto

Solicitação do usuário: "Criar um rig de braço simples com IK e animá-lo alcançando um cubo"

import bpy

bpy.ops.object.select_all(action='SELECT')
bpy.ops.object.delete()

arm_data = bpy.data.armatures.new("ArmRig")
arm_obj = bpy.data.objects.new("ArmRig", arm_data)
bpy.context.collection.objects.link(arm_obj)
bpy.context.view_layer.objects.active = arm_obj
bpy.ops.object.mode_set(mode='EDIT')
prev = None
for nome, head, tail in [("UpperArm",(0,0,1.5),(0.6,0,1.5)),
                          ("Forearm",(0.6,0,1.5),(1.2,0,1.5)),
                          ("Hand",(1.2,0,1.5),(1.4,0,1.5))]:
    b = arm_data.edit_bones.new(nome)
    b.head, b.tail = head, tail
    if prev: b.parent, b.use_connect = prev, True
    prev = b
bpy.ops.object.mode_set(mode='OBJECT')

# Alvo IK + restrição
bpy.ops.object.empty_add(type='PLAIN_AXES', location=(1.2, 0, 1.5))
alvo_ik = bpy.context.active_object
alvo_ik.name = "IK_Hand"
bpy.context.view_layer.objects.active = arm_obj
bpy.ops.object.mode_set(mode='POSE')
ik = arm_obj.pose.bones["Hand"].constraints.new('IK')
ik.target, ik.chain_count = alvo_ik, 3
bpy.ops.object.mode_set(mode='OBJECT')

# Animar alvo IK alcançando um cubo
bpy.ops.mesh.primitive_cube_add(size=0.3, location=(1.5, 0.5, 1.0))
for loc, frame in [((1.2,0,1.5),1), ((1.5,0.5,1.0),30), ((1.5,0.5,1.3),50)]:
    alvo_ik.location = loc
    alvo_ik.keyframe_insert(data_path="location", frame=frame)
for fc in alvo_ik.animation_data.action.fcurves:
    for kp in fc.keyframe_points:
        kp.interpolation, kp.easing = 'BEZIER', 'EASE_IN_OUT'
bpy.context.scene.frame_end = 50
bpy.ops.wm.save_as_mainfile(filepath="/tmp/arm_grab.blend")

Diretrizes

  • data_path deve corresponder exatamente ao caminho RNA: "location", "rotation_euler", "scale", '["custom_prop"]'.
  • Fluxo de trabalho de armadura: Modo Edit para ossos (edit_bones), Modo Pose para restrições e quadros-chave (pose.bones).
  • Para IK, use objetos Empty como alvos. chain_count=0 resolve toda a cadeia até a raiz.
  • Shape keys precisam de uma chave "Basis" primeiro. Anime via key_blocks["Name"].value (0.0 a 1.0).
  • Interpolação: CONSTANT para pausa/passo, LINEAR para movimento mecânico, BEZIER com easing para movimento orgânico.
  • Defina animation_data.action = None para permitir que faixas NLA conduzam — uma ação ativa sobrepõe a NLA.
  • Para ciclos de caminhada, crie quadro-chave de uma passada e use um modificador de F-Curve Cycles ou repetição NLA para loop.
  • Antes da exportação, asse restrições/drivers com bpy.ops.nla.bake() — outros softwares não conseguem lê-los.

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

TerminalSkills/skills

>- Run GitHub Actions locally with act. Use when a user asks to test GitHub Actions workflows locally, debug CI pipelines without pushing, or run workflows offline.

TerminalSkills/skills

>- You are an expert in AG2 (formerly AutoGen), the open-source multi-agent conversation framework. You help developers build systems where multiple AI agents collaborate through structured conversations — with tool use, human-in-the-loop, code execution, group chat orchestration, and nested conversations — for complex tasks like software development, research, and data analysis.

TerminalSkills/skills

>- Generate short-form videos with AI — script writing, text-to-speech narration, stock footage selection, subtitle generation, and video assembly. Use when: creating TikTok/YouTube Shorts/Reels content, automating video production, building content pipelines.

TerminalSkills/skills

>- Automate motion capture and tracking workflows in Blender with Python. Use when the user wants to import BVH or FBX mocap data, retarget motion to armatures, track camera or object motion from video, solve camera motion, clean up motion capture data, or script any tracking pipeline in Blender.

TerminalSkills/skills

>- You are an expert in Bolt.new by StackBlitz, the AI-powered full-stack development environment that runs entirely in the browser. You help developers go from idea to deployed app in minutes using natural language prompts — Bolt generates complete applications with frontend, backend, database, and deployment, all running in a WebContainer without local setup.

TerminalSkills/skills

>- Assists with using Bun as an all-in-one JavaScript/TypeScript runtime, package manager, bundler, and test runner. Use when building HTTP servers, managing packages, running tests, or migrating from Node.js. Trigger words: bun, bun serve, bun install, bun test, bun build, javascript runtime, bun runtime.

TerminalSkills/skills

>- Self-host customer support with Chatwoot. Use when a user asks to set up open-source customer support, add live chat without SaaS costs, build a multi-channel inbox, or deploy a free Intercom alternative.

TerminalSkills/skills

>- You are an expert in Chi, the lightweight, idiomatic Go HTTP router built on `net/http`. You help developers build composable HTTP services using Chi's middleware stack, route groups, URL parameters, sub-routers, and context-based request scoping — providing Express-like ergonomics while staying 100% compatible with Go's standard library.

TerminalSkills/skills

When the user wants to edit, review, or improve existing marketing copy. Also use when the user mentions 'edit this copy,' 'review my copy,' 'copy feedback,' 'proofread,' 'polish this,' 'make this better,' or 'copy sweep.' This skill provides a systematic approach to editing marketing copy through multiple focused passes.

TerminalSkills/skills

>- Add live chat and customer support with Crisp. Use when a user asks to add a chat widget, implement live customer support, set up a help desk, create a knowledge base, or add a chatbot to a website.

TerminalSkills/skills

>- Assists with building custom interactive data visualizations using D3.js. Use when creating charts, graphs, maps, force layouts, or hierarchical diagrams that require fine-grained control beyond what charting libraries provide. Trigger words: d3, data visualization, chart, svg, scales, force graph, treemap, choropleth.

TerminalSkills/skills

dbt (data build tool) transforms data in your warehouse using SQL SELECT statements. Learn project setup, models, tests, documentation, incremental materializations, and integration with data warehouses like PostgreSQL, BigQuery, and Snowflake.

TerminalSkills/skills

>- You are an expert in dlt, the open-source Python library for building data pipelines. You help developers load data from any API, file, or database into warehouses and lakes using simple Python decorators — with automatic schema inference, incremental loading, and built-in data contracts. dlt is the "requests library for data pipelines.

TerminalSkills/skills

Data Version Control for ML projects. Track large datasets and models alongside Git, build reproducible ML pipelines, and run experiments with metric comparison. Works with any storage backend including S3, GCS, Azure, and local filesystems.

TerminalSkills/skills

>- You are an expert in E2B, the cloud platform for running AI-generated code in secure sandboxes. You help developers give AI agents the ability to execute code, install packages, read/write files, and run long processes in isolated cloud environments — each sandbox is a lightweight VM that boots in ~150ms with full Linux, filesystem, and networking.

TerminalSkills/skills

>- Transcode, convert, edit, and process audio and video with FFmpeg. Use when a user asks to convert video formats (webm to mp4, mkv to mp4), extract audio from video, compress video files, trim or cut clips, concatenate videos, add subtitles, create thumbnails, apply filters, change resolution or bitrate, re-encode media, create GIFs from video, add watermarks, normalize audio, stream media, or build automated media processing pipelines.

TerminalSkills/skills

>- Create advanced animations with GSAP. Use when building complex timelines, scroll-driven animations, SVG morphing, text animations, or high-performance web animations beyond CSS capabilities.

TerminalSkills/skills

>- Generate deterministic MP4 videos from HTML, CSS, media, and seekable animations using HeyGen's HyperFrames framework. Use when someone asks to "render HTML to video", "make a video with HyperFrames", "create a programmatic video", "turn an animation into MP4", "build a launch/product video from HTML", "render GSAP/Lottie/Three.js to video", or set up an agent-driven video pipeline. Covers init/preview/render/add/lint/inspect commands, data-* timing attributes, animation adapters, and the component catalog.

TerminalSkills/skills

When the user wants to perform load testing, stress testing, or performance testing of APIs and websites using k6. Also use when the user mentions "k6," "load test," "performance test," "stress test," "spike test," "soak test," "thresholds," "virtual users," or "VUs." For browser-based testing, see selenium.

TerminalSkills/skills

>- Lovable (formerly GPT Engineer) is a browser-based AI app builder that turns a natural-language description into a working full-stack web app with a built-in backend, authentication, database and one-click publishing. Use when the user wants to prototype or ship a web app with Lovable, write effective Lovable prompts, connect Supabase or GitHub, review generated security rules, or move a Lovable project into their own editor.

Habilidades Relacionadas