2023年3月30日木曜日

幻想の二重課税 Y 軸方向 光時計 中心から「速度1x 時間」距離 離れる球体 目印

aaa

基準速度えん で

distance  で 速度を作る

60単位 移動
600 フレーム





# Calculate the distance between start_pos and end_pos
distance = abs(math.sqrt((end_pos[0]-start_pos[0])**2 + (end_pos[1]-start_pos[1])**2 + (end_pos[2]-start_pos[2])**2))


chousei = 1 / distance # 斜め進みと flame の関係?

# Calculate the velocity required to move the sphere at a constant speed
velocity = (end_frame - start_frame) * vvv_velocity * chousei














# Z15  速度基準 えんばん X 軸 ana 方向 Y_回転_True 

import bpy
import math
from mathutils import Matrix
from math import radians


zousoku = 1.0


zion_radius = 15.0
zion_depth = 0.0

zion_sx = 30.0
zion_sy = 0.0
zion_sz = 15.0

zion_ex = -30.0
zion_ey = 0.0
zion_ez = 15.0

vvv_velocity =0.01
zion_obj = "基準速度えん_X"
zion_camera ="基準速度えん_X cam"
zion_cam_location = (0.0, -30.0, 0.0)


# 幻の球体速度用
zion_maboroshi_radius = 1.6
zion_maboroshi_subdivisions = 32


# -y 球体 移動
zion_y_zure = -60

# +y 球体 移動
zion_y_zure = 60






# Set a flag to indicate whether to apply the rotation or not

zion_xx_apply_rotation = False
zion_yy_apply_rotation = True
zion_zz_apply_rotation = False

zion_start_pos = (zion_sx, zion_sy, zion_sz)
zion_end_pos = (zion_ex, zion_ey, zion_ez)





# Create a cylinder object
bpy.ops.mesh.primitive_cylinder_add(radius=zion_radius, depth=zion_depth, location=(zion_sx, zion_sy, zion_sz))


# Get a reference to the newly created object
obj = bpy.context.active_object


# Create a rotation matrix for a 90 degree rotation around the x-axis if apply_rotation is True
if zion_xx_apply_rotation:
    rotation_matrix = Matrix.Rotation(radians(90.0), 4, 'X')
else:
    rotation_matrix = Matrix.Identity(4)

# Apply the rotation to the object's world matrix
obj.matrix_world @= rotation_matrix


# Create a rotation matrix for a 90 degree rotation around the y-axis if apply_rotation is True
if zion_yy_apply_rotation:
    rotation_matrix = Matrix.Rotation(radians(90.0), 4, 'Y')
else:
    rotation_matrix = Matrix.Identity(4)

# Apply the rotation to the object's world matrix
obj.matrix_world @= rotation_matrix



# Create a rotation matrix for a 90 degree rotation around the x-axis if apply_rotation is True
if zion_zz_apply_rotation:
    rotation_matrix = Matrix.Rotation(radians(90.0), 4, 'Z')
else:
    rotation_matrix = Matrix.Identity(4)

# Apply the rotation to the object's world matrix
obj.matrix_world @= rotation_matrix



# オブジェクトに名前を付ける
bpy.context.object.name = zion_obj



# Set start and end frames
start_frame = 1
end_frame = start_frame + 600

# Define the start and end positions
start_pos = zion_start_pos
end_pos = zion_end_pos



# Calculate the distance between start_pos and end_pos
distance = abs(math.sqrt((end_pos[0]-start_pos[0])**2 + (end_pos[1]-start_pos[1])**2 + (end_pos[2]-start_pos[2])**2))



chousei = 1 / distance # 斜め進みと flame の関係?

# Calculate the velocity required to move the sphere at a constant speed
velocity = (end_frame - start_frame) * vvv_velocity * chousei



# Move the sphere and cylinder from start_pos to end_pos at a constant speed
for i in range(start_frame, end_frame + 1):
    bpy.context.scene.frame_set(i)
    bpy.context.object.location = tuple(s + (e-s)*((i-start_frame)*velocity/distance) for s,e in zip(start_pos, end_pos))
    bpy.context.object.keyframe_insert(data_path="location", index=-1)
    bpy.context.object.keyframe_insert(data_path="scale", index=-1)

# Stop the sphere and cylinder from moving after reaching the end position
bpy.context.scene.frame_set(end_frame)
bpy.context.object.keyframe_insert(data_path="location", index=-1)
bpy.context.object.keyframe_insert(data_path="scale", index=-1)

# Set the waiting period
wait_frames = 30
end_frame += wait_frames

# Set the current frame to the end_frame
current_frame = end_frame

# Keep the sphere and cylinder at the end position and repeat the animation
repeat_frames = end_frame + 200
while True:
    current_frame += 1
    
    # Insert a keyframe at the current frame for the sphere and cylinder's location and scale
    bpy.context.scene.frame_set(current_frame)
    bpy.context.object.location = end_pos
    bpy.context.object.keyframe_insert(data_path="location", index=-1)
    bpy.context.object.keyframe_insert(data_path="scale", index=-1)
    
    # Stop the loop if current_frame reaches repeat_frames
    if current_frame == repeat_frames:
        break



# Add a camera and set its position
cam_data = bpy.data.cameras.new('Camera')
cam_data.lens = 600.0  # set focal length to 50mm (zoomed in)
cam = bpy.data.objects.new('Camera', cam_data)
bpy.context.scene.collection.objects.link(cam)
cam.location = zion_cam_location

cam.name = zion_camera

# Add a track constraint to the camera to follow the sphere
track_constraint = cam.constraints.new(type='TRACK_TO')
track_constraint.target = bpy.context.object
track_constraint.track_axis



# import bpy

# アクティブなシーンを取得する
scene = bpy.context.scene

# 開始フレームを1に設定する
scene.frame_start = 1

# 終了フレームを640に設定する
scene.frame_end = 640




# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa



# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa


# Z15  まぼろし 球体 円板の中心 イメージ中心 原子

import bpy
import math
from mathutils import Matrix
from math import radians


zion_start_pos = (zion_sx, zion_sy, zion_sz)
zion_end_pos = (zion_ex, zion_ey, zion_ez)



# Define the start and end positions
start_pos = zion_start_pos
end_pos = zion_end_pos




vvv_velocity = vvv_velocity

zion_obj = "イメージ中心 球体"
zion_camera ="イメージ中心 球体 cam"
zion_cam_location = zion_cam_location





# Set the location, radius, and number of subdivisions
zion_location = (zion_sx, zion_sy, zion_sz)
radius =zion_maboroshi_radius
subdivisions =zion_maboroshi_subdivisions


# Create a sphere object
bpy.ops.mesh.primitive_uv_sphere_add(location=zion_location, radius=zion_maboroshi_radius, segments=subdivisions, ring_count=subdivisions)


# Get a reference to the newly created object
obj = bpy.context.active_object


# オブジェクトに名前を付ける
bpy.context.object.name = zion_obj


# Set start and end frames
start_frame = 1
end_frame = start_frame + 600

# Define the start and end positions
start_pos = zion_start_pos
end_pos = zion_end_pos



# Calculate the distance between start_pos and end_pos
# distance = abs(math.sqrt((end_pos[0]-start_pos[0])**2 + (end_pos[1]-start_pos[1])**2 + (end_pos[2]-start_pos[2])**2))



chousei = 1 / distance # 斜め進みと flame の関係?

# Calculate the velocity required to move the sphere at a constant speed
velovelocity = (end_frame - start_frame) * vvv_velocity * chousei *zousoku






# Move the sphere and cylinder from start_pos to end_pos at a constant speed
for i in range(start_frame, end_frame + 1):
    bpy.context.scene.frame_set(i)
    bpy.context.object.location = tuple(s + (e-s)*((i-start_frame)*velocity/distance) for s,e in zip(start_pos, end_pos))
    bpy.context.object.keyframe_insert(data_path="location", index=-1)
    bpy.context.object.keyframe_insert(data_path="scale", index=-1)

# Stop the sphere and cylinder from moving after reaching the end position
bpy.context.scene.frame_set(end_frame)
bpy.context.object.keyframe_insert(data_path="location", index=-1)
bpy.context.object.keyframe_insert(data_path="scale", index=-1)

# Set the waiting period
wait_frames = 30
end_frame += wait_frames

# Set the current frame to the end_frame
current_frame = end_frame

# Keep the sphere and cylinder at the end position and repeat the animation
repeat_frames = end_frame + 200
while True:
    current_frame += 1
    
    # Insert a keyframe at the current frame for the sphere and cylinder's location and scale
    bpy.context.scene.frame_set(current_frame)
    bpy.context.object.location = end_pos
    bpy.context.object.keyframe_insert(data_path="location", index=-1)
    bpy.context.object.keyframe_insert(data_path="scale", index=-1)
    
    # Stop the loop if current_frame reaches repeat_frames
    if current_frame == repeat_frames:
        break



# Add a camera and set its position
cam_data = bpy.data.cameras.new('Camera')
cam_data.lens = 600.0  # set focal length to 50mm (zoomed in)
cam = bpy.data.objects.new('Camera', cam_data)
bpy.context.scene.collection.objects.link(cam)
cam.location = zion_cam_location

cam.name = zion_camera

# Add a track constraint to the camera to follow the sphere
track_constraint = cam.constraints.new(type='TRACK_TO')
track_constraint.target = bpy.context.object
track_constraint.track_axis



# import bpy

# アクティブなシーンを取得する
scene = bpy.context.scene

# 開始フレームを1に設定する
scene.frame_start = 1

# 終了フレームを640に設定する
scene.frame_end = 640




# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa


# Z15  まぼろし 球体 -y 

import bpy
import math
from mathutils import Matrix
from math import radians


zion_start_pos = (zion_sx, zion_sy, zion_sz)
zion_end_pos = (zion_ex, zion_ey - zion_y_zure, zion_ez)



# Define the start and end positions
start_pos = zion_start_pos
end_pos = zion_end_pos




vvv_velocity = vvv_velocity

zion_obj = "幻 -y 球体"
zion_camera ="幻 -y 球体 cam"
zion_cam_location = zion_cam_location





# Set the location, radius, and number of subdivisions
zion_location = (zion_sx, zion_sy, zion_sz)
radius =zion_maboroshi_radius
subdivisions =zion_maboroshi_subdivisions


# Create a sphere object
bpy.ops.mesh.primitive_uv_sphere_add(location=zion_location, radius=zion_maboroshi_radius, segments=subdivisions, ring_count=subdivisions)


# Get a reference to the newly created object
obj = bpy.context.active_object


# オブジェクトに名前を付ける
bpy.context.object.name = zion_obj


# Set start and end frames
start_frame = 1
end_frame = start_frame + 600

# Define the start and end positions
start_pos = zion_start_pos
end_pos = zion_end_pos



# Calculate the distance between start_pos and end_pos
# distance = abs(math.sqrt((end_pos[0]-start_pos[0])**2 + (end_pos[1]-start_pos[1])**2 + (end_pos[2]-start_pos[2])**2))



chousei = 1 / distance # 斜め進みと flame の関係?

# Calculate the velocity required to move the sphere at a constant speed
velovelocity = (end_frame - start_frame) * vvv_velocity * chousei *zousoku






# Move the sphere and cylinder from start_pos to end_pos at a constant speed
for i in range(start_frame, end_frame + 1):
    bpy.context.scene.frame_set(i)
    bpy.context.object.location = tuple(s + (e-s)*((i-start_frame)*velocity/distance) for s,e in zip(start_pos, end_pos))
    bpy.context.object.keyframe_insert(data_path="location", index=-1)
    bpy.context.object.keyframe_insert(data_path="scale", index=-1)

# Stop the sphere and cylinder from moving after reaching the end position
bpy.context.scene.frame_set(end_frame)
bpy.context.object.keyframe_insert(data_path="location", index=-1)
bpy.context.object.keyframe_insert(data_path="scale", index=-1)

# Set the waiting period
wait_frames = 30
end_frame += wait_frames

# Set the current frame to the end_frame
current_frame = end_frame

# Keep the sphere and cylinder at the end position and repeat the animation
repeat_frames = end_frame + 200
while True:
    current_frame += 1
    
    # Insert a keyframe at the current frame for the sphere and cylinder's location and scale
    bpy.context.scene.frame_set(current_frame)
    bpy.context.object.location = end_pos
    bpy.context.object.keyframe_insert(data_path="location", index=-1)
    bpy.context.object.keyframe_insert(data_path="scale", index=-1)
    
    # Stop the loop if current_frame reaches repeat_frames
    if current_frame == repeat_frames:
        break



# Add a camera and set its position
cam_data = bpy.data.cameras.new('Camera')
cam_data.lens = 600.0  # set focal length to 50mm (zoomed in)
cam = bpy.data.objects.new('Camera', cam_data)
bpy.context.scene.collection.objects.link(cam)
cam.location = zion_cam_location

cam.name = zion_camera

# Add a track constraint to the camera to follow the sphere
track_constraint = cam.constraints.new(type='TRACK_TO')
track_constraint.target = bpy.context.object
track_constraint.track_axis



# import bpy

# アクティブなシーンを取得する
scene = bpy.context.scene

# 開始フレームを1に設定する
scene.frame_start = 1

# 終了フレームを640に設定する
scene.frame_end = 640



# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa


# Z15  まぼろし 球体 +y 

import bpy
import math
from mathutils import Matrix
from math import radians


zion_start_pos = (zion_sx, zion_sy, zion_sz)
zion_end_pos = (zion_ex, zion_ey - zion_y_zure, zion_ez)



# Define the start and end positions
start_pos = zion_start_pos
end_pos = zion_end_pos




vvv_velocity = vvv_velocity

zion_obj = "幻 -y 球体"
zion_camera ="幻 -y 球体 cam"
zion_cam_location = zion_cam_location





# Set the location, radius, and number of subdivisions
zion_location = (zion_sx, zion_sy, zion_sz)
radius =zion_maboroshi_radius
subdivisions =zion_maboroshi_subdivisions


# Create a sphere object
bpy.ops.mesh.primitive_uv_sphere_add(location=zion_location, radius=zion_maboroshi_radius, segments=subdivisions, ring_count=subdivisions)


# Get a reference to the newly created object
obj = bpy.context.active_object


# オブジェクトに名前を付ける
bpy.context.object.name = zion_obj


# Set start and end frames
start_frame = 1
end_frame = start_frame + 600

# Define the start and end positions
start_pos = zion_start_pos
end_pos = zion_end_pos



# Calculate the distance between start_pos and end_pos
# distance = abs(math.sqrt((end_pos[0]-start_pos[0])**2 + (end_pos[1]-start_pos[1])**2 + (end_pos[2]-start_pos[2])**2))



chousei = 1 / distance # 斜め進みと flame の関係?

# Calculate the velocity required to move the sphere at a constant speed
velovelocity = (end_frame - start_frame) * vvv_velocity * chousei *zousoku






# Move the sphere and cylinder from start_pos to end_pos at a constant speed
for i in range(start_frame, end_frame + 1):
    bpy.context.scene.frame_set(i)
    bpy.context.object.location = tuple(s + (e-s)*((i-start_frame)*velocity/distance) for s,e in zip(start_pos, end_pos))
    bpy.context.object.keyframe_insert(data_path="location", index=-1)
    bpy.context.object.keyframe_insert(data_path="scale", index=-1)

# Stop the sphere and cylinder from moving after reaching the end position
bpy.context.scene.frame_set(end_frame)
bpy.context.object.keyframe_insert(data_path="location", index=-1)
bpy.context.object.keyframe_insert(data_path="scale", index=-1)

# Set the waiting period
wait_frames = 30
end_frame += wait_frames

# Set the current frame to the end_frame
current_frame = end_frame

# Keep the sphere and cylinder at the end position and repeat the animation
repeat_frames = end_frame + 200
while True:
    current_frame += 1
    
    # Insert a keyframe at the current frame for the sphere and cylinder's location and scale
    bpy.context.scene.frame_set(current_frame)
    bpy.context.object.location = end_pos
    bpy.context.object.keyframe_insert(data_path="location", index=-1)
    bpy.context.object.keyframe_insert(data_path="scale", index=-1)
    
    # Stop the loop if current_frame reaches repeat_frames
    if current_frame == repeat_frames:
        break



# Add a camera and set its position
cam_data = bpy.data.cameras.new('Camera')
cam_data.lens = 600.0  # set focal length to 50mm (zoomed in)
cam = bpy.data.objects.new('Camera', cam_data)
bpy.context.scene.collection.objects.link(cam)
cam.location = zion_cam_location

cam.name = zion_camera

# Add a track constraint to the camera to follow the sphere
track_constraint = cam.constraints.new(type='TRACK_TO')
track_constraint.target = bpy.context.object
track_constraint.track_axis



# import bpy

# アクティブなシーンを取得する
scene = bpy.context.scene

# 開始フレームを1に設定する
scene.frame_start = 1

# 終了フレームを640に設定する
scene.frame_end = 640



# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa






# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa


# Z15  まぼろし 球体 +y 

import bpy
import math
from mathutils import Matrix
from math import radians


zion_start_pos = (zion_sx, zion_sy, zion_sz)
zion_end_pos = (zion_ex, zion_ey - zion_y_zure, zion_ez)



# Define the start and end positions
start_pos = zion_start_pos
end_pos = zion_end_pos




vvv_velocity = vvv_velocity

zion_obj = "Gr幻 -y 球体"
zion_camera ="Gr幻 -y 球体 cam"
zion_cam_location = zion_cam_location





# Set the location, radius, and number of subdivisions
zion_location = (zion_sx, zion_sy, zion_sz)
radius =zion_maboroshi_radius
subdivisions =zion_maboroshi_subdivisions


# Create a sphere object
bpy.ops.mesh.primitive_uv_sphere_add(location=zion_location, radius=zion_maboroshi_radius, segments=subdivisions, ring_count=subdivisions)


# Get a reference to the newly created object
obj = bpy.context.active_object


# オブジェクトに名前を付ける
bpy.context.object.name = zion_obj


# Set start and end frames
start_frame = 1
end_frame = start_frame + 600

# Define the start and end positions
start_pos = zion_start_pos
end_pos = zion_end_pos



# Calculate the distance between start_pos and end_pos
# distance = abs(math.sqrt((end_pos[0]-start_pos[0])**2 + (end_pos[1]-start_pos[1])**2 + (end_pos[2]-start_pos[2])**2))



chousei = 1 / distance # 斜め進みと flame の関係?

# Calculate the velocity required to move the sphere at a constant speed
velovelocity = (end_frame - start_frame) * vvv_velocity * chousei *zousoku






# Move the sphere and cylinder from start_pos to end_pos at a constant speed
for i in range(start_frame, end_frame + 1):
    bpy.context.scene.frame_set(i)
    bpy.context.object.location = tuple(s + (e-s)*((i-start_frame)*velocity/distance) for s,e in zip(start_pos, end_pos))
    bpy.context.object.keyframe_insert(data_path="location", index=-1)
    bpy.context.object.keyframe_insert(data_path="scale", index=-1)

# Stop the sphere and cylinder from moving after reaching the end position
bpy.context.scene.frame_set(end_frame)
bpy.context.object.keyframe_insert(data_path="location", index=-1)
bpy.context.object.keyframe_insert(data_path="scale", index=-1)

# Set the waiting period
wait_frames = 30
end_frame += wait_frames

# Set the current frame to the end_frame
current_frame = end_frame

# Keep the sphere and cylinder at the end position and repeat the animation
repeat_frames = end_frame + 200
while True:
    current_frame += 1
    
    # Insert a keyframe at the current frame for the sphere and cylinder's location and scale
    bpy.context.scene.frame_set(current_frame)
    bpy.context.object.location = end_pos
    bpy.context.object.keyframe_insert(data_path="location", index=-1)
    bpy.context.object.keyframe_insert(data_path="scale", index=-1)
    
    # Stop the loop if current_frame reaches repeat_frames
    if current_frame == repeat_frames:
        break



# Add a camera and set its position
cam_data = bpy.data.cameras.new('Camera')
cam_data.lens = 600.0  # set focal length to 50mm (zoomed in)
cam = bpy.data.objects.new('Camera', cam_data)
bpy.context.scene.collection.objects.link(cam)
cam.location = zion_cam_location

cam.name = zion_camera

# Add a track constraint to the camera to follow the sphere
track_constraint = cam.constraints.new(type='TRACK_TO')
track_constraint.target = bpy.context.object
track_constraint.track_axis



# import bpy

# アクティブなシーンを取得する
scene = bpy.context.scene

# 開始フレームを1に設定する
scene.frame_start = 1

# 終了フレームを640に設定する
scene.frame_end = 640



# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

































bbb

連番 007 未来光円錐 過去光円錐 円周中心からの球体放出

aaa 参考 2023年3月26日日曜日 製作 002b 未来光円錐の方向 線路レールで https://ia2023sha.blogspot.com/2023/03/002b.html import bpy import math zion_co...