360個 円周球体

 

 

https://groq.com/

 

Here is the Python script that creates 360 small spheres with a radius of 0.05, and arranges them on a circle with a radius of 1 centered at (0, 0, 0) in both the x-y plane and the z-x plane. The spheres are collected into two collections, "xy_plane" and "zx_plane".

```python
import bpy
import math

# Create a new collection for the xy plane
xy_plane_collection = bpy.data.collections.new("xy_plane")

# Create a new collection for the zx plane
zx_plane_collection = bpy.data.collections.new("zx_plane")

# Create 360 small spheres with a radius of 0.05
for i in range(360):
    # Create a new sphere
    sphere = bpy.data.meshes.primitive_IcoSphere(radius=0.05, subdivisions=3)
    sphere.name = "small_sphere_000" + str(i).zfill(3)

    # Add the sphere to the xy plane collection
    xy_plane_collection.objects.link(sphere)
    bpy.context.collection.objects.link(sphere)

    # Calculate the x and y coordinates for the sphere
    x = math.cos(math.radians(i)) * 1
    y = math.sin(math.radians(i)) * 1

    # Set the location of the sphere
    sphere.location = (x, y, 0)

# Create 360 small spheres with a radius of 0.05
for i in range(360):
    # Create a new sphere
    sphere = bpy.data.meshes.primitive_IcoSphere(radius=0.05, subdivisions=3)
    sphere.name = "small_sphere_000" + str(i).zfill(3)

    # Add the sphere to the zx plane collection
    zx_plane_collection.objects.link(sphere)
    bpy.context.collection.objects.link(sphere)

    # Calculate the x and z coordinates for the sphere
    x = math.cos(math.radians(i)) * 1
    z = math.sin(math.radians(i)) * 1

    # Set the location of the sphere
    sphere.location = (x, 0, z)

# Link the collections to the active collection
bpy.context.collection.objects.link(xy_plane_collection)
bpy.context.collection.objects.link(zx_plane_collection)
```

This script creates two collections, "xy_plane" and "zx_plane", and adds 360 small spheres to each collection. The spheres are arranged on a circle with a radius of 1 centered at (0, 0, 0) in both the x-y plane and the z-x plane. The spheres are linked to the active collection.

 

 

 

 

 

This script is creating an animation in Blender using Python. Here's a breakdown of what it does:

1. It sets a speed factor to control the speed of the animation. A value of 0.1 means the animation will be 10 times slower, while a value of 10 means it will be 10 times faster.
2. It creates a new scene and gets the active scene.
3. It creates a circle mesh with 100 points and adds it to the scene.
4. It creates a sphere object and sets its location to the origin (0, 0, 0).
5. It sets keyframes for the sphere object's location to create an animation. The animation moves the sphere around the circle, with each frame spaced 30 frames apart (based on the speed factor).
6. It sets the animation to loop by setting the frame start and end values.
7. Finally, it plays the animation.

The script is creating an animation of a sphere moving around a circle, with the speed of the animation controlled by the `speed_factor` variable.

 

 

 

 

 

 

10周 ループ

 

 

 

# キーフレームを設定してアニメーションを作成 def animate_spheres(sphere_objs, num_points, radius, angle_step, speed_factor): for i in range(num_points * 10): # 10周分のキーフレームを設定 for j, sphere_obj in enumerate(sphere_objs): angle = i * angle_step * speed_factor sphere_obj.location = ( radius * math.cos(angle + j * (2 * math.pi / len(sphere_objs))), radius * math.sin(angle + j * (2 * math.pi / len(sphere_objs))), 0 ) sphere_obj.keyframe_insert( data_path="location", frame=i * 30 / (num_points * speed_factor) ) # ループのためのキーフレームを設定 for i in range(num_points * 10, num_points * 11): for j, sphere_obj in enumerate(sphere_objs): angle = i * angle_step * speed_factor sphere_obj.location = ( radius * math.cos(angle + j * (2 * math.pi / len(sphere_objs))), radius * math.sin(angle + j * (2 * math.pi / len(sphere_objs))), 0 ) sphere_obj.keyframe_insert( data_path="location", frame=i * 30 / (num_points * speed_factor) ) # XY平面の球体をアニメート animate_spheres(sphere_objs_xy, num_points_xy, radius_xy, angle_step_xy, speed_factor_xy) # ZX平面の球体をアニメート animate_spheres(sphere_objs_zx, num_points_zx, radius_zx, angle_step_zx, speed_factor_zx) # YZ平面の球体をアニメート animate_spheres(sphere_objs_yz, num_points_yz, radius_yz, angle_step_yz, speed_factor_yz) # アニメーションを連続してループさせる設定 scene = bpy.context.scene loop_time_xy = 30 * num_points_xy * 11 / (speed_factor_xy * num_points_xy) # 10周分 + 1周分 loop_time_zx = 30 * num_points_zx * 11 / (speed_factor_zx * num_points_zx) loop_time_yz = 30 * num_points_yz * 11 / (speed_factor_yz * num_points_yz) scene.frame_end = int(max(loop_time_xy, loop_time_zx, loop_time_yz)) scene.frame_start = 1 scene.frame_current = 1 scene.frame_step = 1 # アニメーションを再生 bpy.ops.screen.animation_play()