Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -119,10 +119,26 @@ def create_meteor_with_particle_system():
|
|
119 |
output_node = nodes.get("Material Output")
|
120 |
material_link = meteor.active_material.node_tree.links.new
|
121 |
material_link(emission_node.outputs[0], output_node.inputs[0])
|
122 |
-
meteor.location = (random.uniform(-10, 10), random.uniform(-10, 10), random.uniform(-10, 10))
|
123 |
-
|
124 |
-
meteor.
|
125 |
-
meteor.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
|
127 |
def create_scene():
|
128 |
|
|
|
119 |
output_node = nodes.get("Material Output")
|
120 |
material_link = meteor.active_material.node_tree.links.new
|
121 |
material_link(emission_node.outputs[0], output_node.inputs[0])
|
122 |
+
##meteor.location = (random.uniform(-10, 10), random.uniform(-10, 10), random.uniform(-10, 10))
|
123 |
+
bpy.context.view_layer.objects.active = meteor
|
124 |
+
meteor.select_set(True)
|
125 |
+
meteor.animation_data_create()
|
126 |
+
meteor.animation_data.action = bpy.data.actions.new(name="OrbitAction")
|
127 |
+
start_frame = 1
|
128 |
+
duration=2
|
129 |
+
radius=5
|
130 |
+
end_frame = int(duration * 10)
|
131 |
+
for frame in range(start_frame, end_frame + 1):
|
132 |
+
angle = (frame / end_frame) * 2 * math.pi
|
133 |
+
x = radius * math.cos(angle)
|
134 |
+
y = radius * math.sin(angle)
|
135 |
+
z = meteor.location.z
|
136 |
+
meteor.location = (x, y, z)
|
137 |
+
meteor.keyframe_insert(data_path="location", index=-1, frame=frame)
|
138 |
+
|
139 |
+
##meteor.keyframe_insert(data_path="location", frame=1)
|
140 |
+
##meteor.location = (random.uniform(-10, 10), random.uniform(-10, 10), random.uniform(-10, 10))
|
141 |
+
##meteor.keyframe_insert(data_path="location", frame=20)
|
142 |
|
143 |
def create_scene():
|
144 |
|