Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -58,9 +58,9 @@ def add_animated_space_rocks():
|
|
58 |
for i in range(30):
|
59 |
bpy.ops.mesh.primitive_uv_sphere_add(radius=random.uniform(0.01, 0.1), location=(random.uniform(-10, 10), random.uniform(-10, 10), random.uniform(-4, 9)))
|
60 |
space_rock = bpy.context.active_object
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
bpy.context.view_layer.objects.active = space_rock
|
65 |
space_rock.select_set(True)
|
66 |
space_rock.animation_data_create()
|
|
|
58 |
for i in range(30):
|
59 |
bpy.ops.mesh.primitive_uv_sphere_add(radius=random.uniform(0.01, 0.1), location=(random.uniform(-10, 10), random.uniform(-10, 10), random.uniform(-4, 9)))
|
60 |
space_rock = bpy.context.active_object
|
61 |
+
space_rock.keyframe_insert(data_path="location", frame=1)
|
62 |
+
space_rock.location = (random.uniform(-10, 10), random.uniform(-10, 10), random.uniform(-10, 10))
|
63 |
+
space_rock.keyframe_insert(data_path="location", frame=duration * bpy.context.scene.render.fps)
|
64 |
bpy.context.view_layer.objects.active = space_rock
|
65 |
space_rock.select_set(True)
|
66 |
space_rock.animation_data_create()
|