# トーラス 完全版 過去光円錐
# トーラス 完全版 過去光円錐
import bpy
import math
# Adjust movement speed
torus_speed = 0.01
# Parameters
radius = 1
# Create a torus
bpy.ops.mesh.primitive_torus_add(align='WORLD', location=(0, 0, -2), rotation=(0, 0, 0), major_radius=radius, minor_radius=0.05)
torus = bpy.context.active_object
# Set the animation for the torus
for i in range(601):
# Set the current frame
bpy.context.scene.frame_set(i)
# Move the torus
loc = (0, 0, -2 + i * torus_speed)
torus.location = loc
# Resize the torus
radius = abs(loc[2])
torus.scale = (radius, radius, radius)
# Add a keyframe
torus.keyframe_insert(data_path="location")
torus.keyframe_insert(data_path="scale")