Created
January 8, 2024 18:08
-
-
Save lzpel/a9c22a394e71e8fc7d84a7861f1955b0 to your computer and use it in GitHub Desktop.
Blender 4.0 insert keyframes with linear interpolation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
from mathutils import Vector | |
# 球を作成 | |
bpy.ops.mesh.primitive_uv_sphere_add(location=(0, 0, 0)) | |
# 球オブジェクトを取得 | |
sphere = bpy.context.active_object | |
# 移動先の座標を定義 | |
positions = [Vector((0, 0, 0)), Vector((1, 0, 0)), Vector((1, 1, 0))] | |
# キーフレームを設定 | |
for i, pos in enumerate(positions): | |
sphere.location = pos | |
sphere.keyframe_insert(data_path="location", frame=i * 24) | |
for i in sphere.animation_data.action.fcurves: | |
for j in i.keyframe_points: | |
j.interpolation = "LINEAR" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment