Sub topic 13
Keyframing Poses in Blender
Prerequisites and animation data
This chapter assumes that you can create an armature, switch between Object, Edit, and Pose modes, and select pose bones. You should also understand the difference between an armature’s rest pose and its current pose.
A keyframe stores a property value at a specific frame. For a pose bone, that value might be its rotation, location, or scale. Blender calculates the values between keyframes by using interpolation. A sequence of keyframes becomes part of an animation Action, which contains animation curves called F-curves.
For example, a character’s arm can have one rotation at frame 1 and another rotation at frame 24:
Insert and inspect pose keyframes
- Select the armature and enter Pose Mode.
- Select one or more bones.
- Move the timeline to frame 1.
- Set the desired rotation, location, or scale.
- Press
Iand choose a keying option, such as Rotation or LocRotScale. - Move to another frame and change the pose.
- Insert another keyframe.
A yellow property usually indicates a keyed value at the current frame. A green property indicates that the value is animated but differs from the value stored at the current frame. You can inspect and edit the animation in the Dope Sheet or Graph Editor.
| Keying choice | What it stores |
|---|---|
| Rotation | Rotation channels for the selected pose bones |
| Location | Location channels |
| LocRotScale | Location, rotation, and scale channels |
The following script keys the first pose bone on the active armature:
import bpy
import math
armature = bpy.context.object
if armature is None or armature.type != 'ARMATURE':
raise RuntimeError("Select an armature object first")
if not armature.pose.bones:
raise RuntimeError("The armature must contain at least one bone")
bone = armature.pose.bones[0]
bone.rotation_mode = 'XYZ'
scene = bpy.context.scene
scene.frame_set(1)
bone.rotation_euler = (0.0, 0.0, 0.0)
bone.keyframe_insert(data_path="rotation_euler", frame=1)
scene.frame_set(24)
bone.rotation_euler = (math.radians(45.0), 0.0, 0.0)
bone.keyframe_insert(data_path="rotation_euler", frame=24)Control interpolation and common errors
By default, Blender often uses Bezier interpolation. The motion accelerates and slows near keyframes. For mechanical motion, select keyframes in the Graph Editor and choose Interpolation Mode > Linear. For a held pose, use Constant.
Auto Keying can insert keys when you transform a keyed property. It speeds up blocking, but it can also create unwanted keys on the wrong bones. Review the Dope Sheet and remove accidental channels.
Keying an edit bone does not animate the character. Edit bones define the rest structure. Animate pose bones in Pose Mode or through the pose.bones API.
Exercise
What should you key to animate a bone’s rotation, and where can you inspect the result?
Show answer
Key the pose bone’s rotation, then inspect its keyframes in the Dope Sheet or its F-curves in the Graph Editor.