2023年4月8日土曜日

ニュートンの tree ball 原型 色なし

 



import bpy


from math import sin, cos, pi


zion_object_name = "幻想 ball 上昇"


# 設定可能な変数

start_pos = (0,0, 30)  # 開始位置

end_pos = (-30, 0, 0)  # 終了位置

radius = 1.0  # 半径

animation_frames = 600  # アニメーションの再生時間(フレーム数)


# 球体を作成する

bpy.ops.mesh.primitive_uv_sphere_add(radius=radius, enter_editmode=False, align='WORLD', location=start_pos)

sphere = bpy.context.object

sphere.name = zion_object_name  # Rename the object


# アニメーションを再生するたびに呼び出される関数

def animate_sphere(scene):

    global sphere

    

    # 現在のフレームにおける球体の位置を計算する

    frame = scene.frame_current

    pos_x = start_pos[0] - ((start_pos[0] - end_pos[0]) / animation_frames) * frame

    pos_y = start_pos[1] - ((start_pos[1] - end_pos[1]) / animation_frames) * frame

    pos_z = start_pos[2] - ((start_pos[2] - end_pos[2]) / animation_frames) * frame

    sphere.location = (pos_x, pos_y, pos_z)


# フレーム更新のコールバック関数を登録する

bpy.app.handlers.frame_change_pre.append(animate_sphere)


# アニメーションの再生時間を設定する

bpy.context.scene.frame_end = animation_frames


# スクリプトを実行する前にフレームを初期化する

bpy.context.scene.frame_set(0)




import bpy


# フレーム数を変更するための関数

def set_frame_range(start_frame, end_frame):

    bpy.context.scene.frame_start = start_frame

    bpy.context.scene.frame_end = end_frame


# 例: フレーム数を100に変更する場合

set_frame_range(1, 1000)






#  幻想 地面 高さ


import bpy


from math import sin, cos, pi


zion_object_name = "幻想 地面高さ ball "


# 設定可能な変数

start_pos = (0,0, 0)  # 開始位置

end_pos = (-30, 0, 0)  # 終了位置

radius = 1.0  # 半径

animation_frames = 600  # アニメーションの再生時間(フレーム数)


# 球体を作成する

bpy.ops.mesh.primitive_uv_sphere_add(radius=radius, enter_editmode=False, align='WORLD', location=start_pos)

sphere = bpy.context.object

sphere.name = zion_object_name  # Rename the object



# アニメーションを再生するたびに呼び出される関数

def animate_sphere(scene):

    global sphere

    

    # 現在のフレームにおける球体の位置を計算する

    frame = scene.frame_current

    pos_x = start_pos[0] - ((start_pos[0] - end_pos[0]) / animation_frames) * frame

    pos_y = start_pos[1] - ((start_pos[1] - end_pos[1]) / animation_frames) * frame

    pos_z = start_pos[2] - ((start_pos[2] - end_pos[2]) / animation_frames) * frame

    sphere.location = (pos_x, pos_y, pos_z)


# フレーム更新のコールバック関数を登録する

bpy.app.handlers.frame_change_pre.append(animate_sphere)


# アニメーションの再生時間を設定する

bpy.context.scene.frame_end = animation_frames


# スクリプトを実行する前にフレームを初期化する

bpy.context.scene.frame_set(0)




import bpy


# フレーム数を変更するための関数

def set_frame_range(start_frame, end_frame):

    bpy.context.scene.frame_start = start_frame

    bpy.context.scene.frame_end = end_frame


# 例: フレーム数を100に変更する場合

set_frame_range(1, 1000)






改良中 y=-30 中心 円周への球体36個

できた y= -30 中心で z=0平面移動  import bpy import math zion_collection_name = "線路レール 観察者" # コレクションを作成する col = bpy.data.collections.new(zio...