回転する線路
2023-04-18
ファイル Dürer & 測距儀2022c084 連番 013 正三角形2つ と 補正の関係
https://blenderzionad.hatenablog.com/entry/2023/04/18/100045
# "回転板 線路"
import bpy
import math
import urllib.request
from math import ceil
# Set the width and height of the object
width, height = 200, 0.4
# Create a plane primitive
bpy.ops.mesh.primitive_plane_add(size=1, enter_editmode=False, align='WORLD', location=(0,0,0))
square_obj = bpy.context.active_object
# オブジェクトに名前を付ける
square_obj.name = "回転板 線路"
# Scale the object to the desired width and height
square_obj.scale[0] = width
square_obj.scale[1] = height
# Set the animation frames and rotation angle
animation_frames = 1000
rotation_angle = 2*math.pi
# Set the keyframes for the rotation animation
for i in range(animation_frames):
bpy.context.scene.frame_set(i)
square_obj.rotation_euler[0] = i/animation_frames * rotation_angle
square_obj.keyframe_insert(data_path="rotation_euler", index=-1)
# Set the final keyframe
bpy.context.scene.frame_set(animation_frames)
square_obj.rotation_euler[0] = rotation_angle
square_obj.keyframe_insert(data_path="rotation_euler", index=-1)
#ああああああああああああああああああああああああああああ
#ああああああああああああああああああああああああああああ