Sub topic 5
Inserting, Updating, and Deleting Keyframes
Assume that you can navigate the 3D Viewport, select an object, change its transforms, and switch an area to the Timeline or Dope Sheet. This chapter focuses on editing keyframes after you understand that a keyframe stores a property value at a specific frame.
Insert a keyframe
Select an object and move the playhead to the frame where an action should begin. Change the object's location, rotation, or scale. To insert a keyframe, place the mouse pointer over the 3D Viewport and press I. Choose a keying option such as Location, Rotation, or LocRotScale.
You can also insert a keyframe from the Properties editor. A property that can be animated has a diamond-shaped keyframe button beside it. Click the button to key only that property.
For example, to animate an object rising:
- Select the object.
- Set the current frame to 1.
- Set its Z location to 0.
- Press
Iand choose Location. - Set the current frame to 24.
- Set its Z location to 2.
- Press
Iand choose Location again.
Blender creates an F-curve for the location property. An F-curve is a record of how one property changes over time. Between the two keyframes, Blender calculates intermediate values.
Update an existing keyframe
To update a keyframe, move the playhead to the frame that already contains one. Change the property value, then insert the same property again. Blender replaces the value on the existing keyframe instead of creating a duplicate key at that frame.
This distinction matters. If the playhead is on frame 24 and the location has a keyframe there, inserting Location updates that key. If the playhead is on frame 30, the same operation creates a new keyframe at frame 30.
The keyframe button also shows whether the current value matches the stored key:
- A filled diamond usually indicates that the current property has a keyframe at the current frame.
- An unfilled diamond indicates that the property is animated but has no key at the current frame.
- A changed color can indicate that the property differs from its keyed value.
Delete a keyframe
To remove a keyframe for a property, move to its frame, place the pointer over the relevant property or the 3D Viewport, and press Alt-I. Blender clears the keyframe for the selected property or the chosen keying set.
To delete several keys:
- Open the Dope Sheet.
- Select the required keys with
B, or useAto select all visible keys. - Press
Xand confirm the deletion.
Deleting a keyframe does not necessarily remove the property from the animation. If other keys remain, Blender continues to interpolate between them. If you delete every key from an F-curve, that property returns to its current non-animated value.
A short Python equivalent
The following script inserts two location keyframes on the active object. Running it from Blender's Scripting workspace requires an active object.
import bpy
scene = bpy.context.scene
obj = bpy.context.active_object
if obj is None:
raise RuntimeError("Select an object before running this script.")
scene.frame_start = 1
scene.frame_end = 48
scene.frame_set(1)
obj.location = (0.0, 0.0, 0.0)
obj.keyframe_insert(data_path="location", frame=1)
scene.frame_set(24)
obj.location = (0.0, 0.0, 2.0)
obj.keyframe_insert(data_path="location", frame=24)
print("Inserted location keyframes at frames 1 and 24.")Exercise
An object has location keyframes at frames 1 and 24. How do you change the value stored at frame 24 without adding a key at another frame?
Show answer
Set the playhead to frame 24, change the object's location, and insert the Location keyframe again.