2023年3月20日月曜日

20230320 mon all 球体 停止電車 中央

aaa

球体 停止電車 中央









import bpy
import math

# Create a sphere object
bpy.ops.mesh.primitive_uv_sphere_add(radius=2.0, location=(0.0, 0.0, 0.0))

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

# Define the start and end positions
start_pos = (0.0, 0.0, 0.0)
end_pos = (0.0, -30.0, 0.0)

# 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))

# Set the speed multiplier
vvv_velocity = 1.0

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

# Move the sphere 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)

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

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

# Set the current frame to the end_frame
current_frame = end_frame

# Keep the sphere 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's location
    bpy.context.scene.frame_set(current_frame)
    bpy.context.object.location = end_pos
    bpy.context.object.keyframe_insert(data_path="location", 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 = bpy.data.objects.new('Camera', cam_data)
bpy.context.scene.collection.objects.link(cam)
cam.location = (0.0, -30.0, 0.0)

# 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









停車 電車 +30


import bpy
import math

# Create a sphere object
bpy.ops.mesh.primitive_uv_sphere_add(radius=2.0, location=(30.0, 0.0, 0.0))

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

# Define the start and end positions
start_pos = (30.0, 0.0, 0.0)
end_pos = (0.0, -30.0, 0.0)

# 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))

# Set the speed multiplier
vvv_velocity = 1.0

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

# Move the sphere 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)

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

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

# Set the current frame to the end_frame
current_frame = end_frame

# Keep the sphere 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's location
    bpy.context.scene.frame_set(current_frame)
    bpy.context.object.location = end_pos
    bpy.context.object.keyframe_insert(data_path="location", 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 = bpy.data.objects.new('Camera', cam_data)
bpy.context.scene.collection.objects.link(cam)
cam.location = (0.0, -30.0, 0.0)

# 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






ピンク 1単位 電車からの中央から左 事象情報 拡散線


import bpy
import math

# Create a sphere object
bpy.ops.mesh.primitive_uv_sphere_add(radius=2.0, location=(-60.0, 0.0, 0.0))

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

# Define the start and end positions
start_pos = (-60.0, 0.0, 0.0)
end_pos = (-30.0, -0.0, 0.0)

# 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))

# Set the speed multiplier
vvv_velocity = 1.0

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

# Move the sphere 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)

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

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

# Set the current frame to the end_frame
current_frame = end_frame

# Keep the sphere 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's location
    bpy.context.scene.frame_set(current_frame)
    bpy.context.object.location = end_pos
    bpy.context.object.keyframe_insert(data_path="location", 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 = bpy.data.objects.new('Camera', cam_data)
bpy.context.scene.collection.objects.link(cam)
cam.location = (0.0, -30.0, 0.0)

# 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





ピンク 1単位 電車からの幻想球体 端から端までの幻想光子


import bpy
import math

# Create a sphere object
bpy.ops.mesh.primitive_uv_sphere_add(radius=4.0, location=(-60.0, 0.0, 0.0))

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

# Define the start and end positions
start_pos = (-60.0, 0.0, 0.0)
end_pos = (+00.0, -0.0, 0.0)

# 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))

# Set the speed multiplier
vvv_velocity = 1.0

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

# Move the sphere 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)

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

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

# Set the current frame to the end_frame
current_frame = end_frame

# Keep the sphere 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's location
    bpy.context.scene.frame_set(current_frame)
    bpy.context.object.location = end_pos
    bpy.context.object.keyframe_insert(data_path="location", 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 = bpy.data.objects.new('Camera', cam_data)
bpy.context.scene.collection.objects.link(cam)
cam.location = (0.0, -30.0, 0.0)

# 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
import math

# Create a sphere object
bpy.ops.mesh.primitive_uv_sphere_add(radius=4.0, location=(-90.0, 0.0, 0.0))

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

# Define the start and end positions
start_pos = (-90.0, 0.0, 0.0)
end_pos = (-60.0, 0.0, 0.0)

# 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))

# Set the speed multiplier
vvv_velocity = 1.0

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

# Move the sphere 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)

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

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

# Set the current frame to the end_frame
current_frame = end_frame

# Keep the sphere 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's location
    bpy.context.scene.frame_set(current_frame)
    bpy.context.object.location = end_pos
    bpy.context.object.keyframe_insert(data_path="location", 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 = bpy.data.objects.new('Camera', cam_data)
bpy.context.scene.collection.objects.link(cam)
cam.location = (0.0, -30.0, 0.0)

# 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
















ピンク電車両端 migi 端



import bpy
import math

# Create a sphere object
bpy.ops.mesh.primitive_uv_sphere_add(radius=4.0, location=(-30.0, 0.0, 0.0))

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

# Define the start and end positions
start_pos = (-30.0, 0.0, 0.0)
end_pos = (-60.0, 0.0, 0.0)

# 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))

# Set the speed multiplier
vvv_velocity = 1.0

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

# Move the sphere 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)

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

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

# Set the current frame to the end_frame
current_frame = end_frame

# Keep the sphere 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's location
    bpy.context.scene.frame_set(current_frame)
    bpy.context.object.location = end_pos
    bpy.context.object.keyframe_insert(data_path="location", 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 = bpy.data.objects.new('Camera', cam_data)
bpy.context.scene.collection.objects.link(cam)
cam.location = (0.0, -30.0, 0.0)

# 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






ピンク電車内 集結地 円柱 Z軸





import bpy
import math

# Create a sphere object
bpy.ops.mesh.primitive_uv_sphere_add(radius=0.7, location=(-60.0, 0.0, 0.0))

# Create a cylinder object
bpy.ops.mesh.primitive_cylinder_add(radius=0.5, depth=60.0, location=(-60.0, 0.0, 0.0))










bbb

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

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