コード中のdiffuse.inputs['Base Color'].default_valueの数値を変更することで、青色を調整することができます。透明感を出すには、RGBA値の4つ目の値(アルファ値)を小さくすることができます。以下は、少し透明感のある青色にする例です。

 

 

diffuse.inputs['Base Color'].default_value = (0.6, 0.7, 1.0, 0.5)
 

 

 

 

アニメーションを繰り返すには、bpy.context.scene.frame_endをアニメーションの再生時間分だけ増やすことができます。以下は、アニメーションを10秒に延長し、無限ループにする例です。

 

 

# 再生時間を設定する
bpy.context.scene.frame_end = 600

# アニメーションを無限ループにする
bpy.context.scene.animation_playback = 'LOOP'
 

 

ああああああああああああああああああああああ

 

 

 

2つの円錐 スクリプト

 

 

import bpy
from mathutils import Vector

zion_object = "逆さ円錐 300上昇"

zion_speed_round = 0.0  # 回転速度を設定する
radius = 60  # 半径を設定する
height = 60  # 高さを設定する
distance_per_frame = 0.1  # 移動する距離を指定する

# 円錐を作成する
bpy.ops.mesh.primitive_cone_add(radius1=0, radius2=radius, depth=height)
cone = bpy.context.object
cone.name = zion_object
cone.location = Vector((0, 0, -height/2))  # 初期位置を設定する
cone.active_material = bpy.data.materials.new(name="zion_material")
cone.active_material.use_nodes = True
node_tree = cone.active_material.node_tree
nodes = node_tree.nodes
links = node_tree.links
diffuse = nodes["Principled BSDF"]
diffuse.inputs['Base Color'].default_value = (0.2, 0.8, 0.5, 0.3)

# 再生時間を設定する
bpy.context.scene.frame_end = 600

# 時間を表すフレーム数の初期値を設定する
frame_num = 0

# 毎フレーム呼び出される関数
def animate_cone(scene):
    global frame_num

    # 現在のフレーム数から円錐の位置を計算する
    z = frame_num * distance_per_frame
    if z <= height:
        cone.location = Vector((0, 0, -height/2 + z))
    else:
        cone.location = Vector((0, 0, height/2))

    # 円錐を回転する
    cone.rotation_euler[2] += zion_speed_round

    # フレーム数を1増やす
    frame_num += 1

    # 指定フレーム数まで達したらアニメーションを停止する
    if frame_num >= 300:
        bpy.ops.screen.animation_cancel(restore_frame=False)

# フレーム更新のコールバック関数を登録する
bpy.app.handlers.frame_change_pre.append(animate_cone)
 

 

import bpy
from mathutils import Vector

zion_object = "逆さ円錐 600上昇"

zion_speed_round = 0.1 # 回転速度を設定する
radius = 60 # 半径を設定する
height = 60 # 高さを設定する
distance_per_frame = 0.1 # 移動する距離を指定する

# 円錐を作成する
bpy.ops.mesh.primitive_cone_add(radius1=0, radius2=radius, depth=height)
cone = bpy.context.object
cone.name = zion_object
cone.location = Vector((0, 0, -height/2)) # 初期位置を設定する
cone.active_material = bpy.data.materials.new(name="zion_material")
cone.active_material.use_nodes = True
node_tree = cone.active_material.node_tree
nodes = node_tree.nodes
links = node_tree.links
diffuse = nodes["Principled BSDF"]
diffuse.inputs['Base Color'].default_value = (0.6, 0.7, 1.0, 0.5)


# 再生時間を設定する
bpy.context.scene.frame_end = 640

# 時間を表すフレーム数の初期値を設定する
frame_num = 0

# 毎フレーム呼び出される関数
def animate_cone(scene):
    global frame_num

    # 現在のフレーム数から円錐の位置を計算する
    z = frame_num * distance_per_frame
    if z <= height:
        cone.location = Vector((0, 0, -height/2 + z))
    else:
        cone.location = Vector((0, 0, height/2))

    # 円錐を回転する
    cone.rotation_euler[2] += zion_speed_round

    # フレーム数を1増やす
    frame_num += 1

    # 指定フレーム数まで達したらアニメーションを停止する
    if frame_num >= 600:
        bpy.ops.screen.animation_cancel(restore_frame=False)

# フレーム更新のコールバック関数を登録する
bpy.app.handlers.frame_change_pre.append(animate_cone)

 

 



# 再生時間を設定する
bpy.context.scene.frame_end = 600

# アニメーションを無限ループにする
bpy.context.scene.animation_playback = 'LOOP'

 

 

 


 

 

 

 

 

import bpy
from mathutils import Vector

zion_object = "逆さ円錐 上昇"

zion_speed_round = 0.1 # 回転速度を設定する
radius = 60 # 半径を設定する
height = 60 # 高さを設定する
distance_per_frame = 0.1 # 移動する距離を指定する

# 円錐を作成する
bpy.ops.mesh.primitive_cone_add(radius1=0, radius2=radius, depth=height)
cone = bpy.context.object
cone.name = zion_object
cone.location = Vector((0, 0, -height/2)) # 初期位置を設定する
cone.active_material = bpy.data.materials.new(name="zion_material")
cone.active_material.use_nodes = True
node_tree = cone.active_material.node_tree
nodes = node_tree.nodes
links = node_tree.links
diffuse = nodes["Principled BSDF"]
diffuse.inputs['Base Color'].default_value = (0.2, 0.8, 0.5, 0.3)

# 再生時間を設定する
bpy.context.scene.frame_end = 600

# 時間を表すフレーム数の初期値を設定する
frame_num = 0

# 毎フレーム呼び出される関数
def animate_cone(scene):
    global frame_num

    # 現在のフレーム数から円錐の位置を計算する
    z = frame_num * distance_per_frame
    if z <= height:
        cone.location = Vector((0, 0, -height/2 + z))
    else:
        cone.location = Vector((0, 0, height/2))

    # 円錐を回転する
    cone.rotation_euler[2] += zion_speed_round

    # フレーム数を1増やす
    frame_num += 1

    # 指定フレーム数まで達したらアニメーションを停止する
    if frame_num >= 300:
        bpy.ops.screen.animation_cancel(restore_frame=False)

# フレーム更新のコールバック関数を登録する
bpy.app.handlers.frame_change_pre.append(animate_cone)