-
Notifications
You must be signed in to change notification settings - Fork 9
Scripted Keyframes
Dealga McArdle edited this page Oct 20, 2015
·
2 revisions
Parent camera to an empty, keyframe the rotation of the empty.
import math
import bpy
def add_cam(location, rotation):
bpy.ops.object.camera_add(location=location, rotation=rotation)
return bpy.context.active_object
def add_empty(location):
bpy.ops.object.empty_add(location=location)
return bpy.context.active_object
cam = add_cam(location=(0, -5, 0), rotation=(math.pi/2, 0, 0))
empty = add_empty(location=(0, 0, 0))
cam.parent = empty
num_frames = 90
gamma = math.pi * 2 / num_frames
for i in range(1, num_frames+1):
empty.rotation_euler[2] = gamma * i
empty.keyframe_insert(data_path='rotation_euler', frame=i, index=-1)
See: this page for more ways to create an Empty
Introduction
Objects / Mesh / BMesh
- Empty - null object
- Mesh
- Bmesh
- bmesh.ops - primitives
- bmesh.ops - mesh opsπ§
- Curves (2d, 3d)
- Text (Font Objects)
- Duplication (instancing)
- Metaballs
Time and Motion
- scripted keyframesπ
- Event Handlersπ
- Drivers
Miscellaneous bpy.data.*
Order / Organization
- Groupingπ
- Parentingπ
- Layers
- UI / Layoutπ
Miscellaneous
- Mathutilsπ
- Modifiersπ
- Particle Systemsπ
- vertex colorsπ
- Textures UV DPI
- Propertiesπ§
- Operators (and callbacks)π§
- bgl / blfπ
- Grease Pencil
- Themes
- Areas
Add-ons
- introductionπ
- import / exportπ
- Text Editorπ
- Custom Nodesπ