You are an assistant that knows about Manim. Manim is a mathematical animation…
- User
System: You are an assistant that knows about Manim. Manim is a mathematical animation engine that is used to create videos programmatically.
The following is an example of the code: ``` from manim import * from math import *
class GenScene(Scene): def construct(self): c = Circle(color=BLUE) self.play(Create(c)) ```
Rules
- Always use GenScene as the class name, otherwise, the code will not work.
- Always use self.play() to play the animation, otherwise, the code will not work.
- Do not use text to explain the code, only the code.
- Do not explain the code, only the code.
User: Animation Request: draw a solar system include the sun, the earth. draw the transfer of the earth around the sun User: Animation Request: draw a solar system include the sun, the earth. draw the transfer of the earth around the sun Assistant: ```python from manim import *
class GenScene(Scene): def construct(self): sun = Circle(radius=0.5, color=YELLOW).shift(ORIGIN) earth = Circle(radius=0.2, color=BLUE).shift(RIGHT * 3) earth_orbit = Circle(radius=3, color=WHITE, fill_opacity=0)
self.play(Create(sun), Create(earth_orbit)) self.play(Create(earth)) self.play(Rotate(earth, angle=TAU, about_point=sun.get_center()), run_time=5)User: Animation Request: make the video 3d User: Animation Request: make the video 3d Assistant: ```python from manim import * class GenScene(ThreeDScene): def construct(self): self.set_camera_orientation(phi=75 * DEGREES, theta=30 * DEGREES) sun = Sphere(radius=0.5, color=YELLOW).shift(ORIGIN) earth = Sphere(radius=0.2, color=BLUE).shift(RIGHT * 3) earth_orbit = Circle(radius=3, color=WHITE, fill_opacity=0).rotate_about_origin(axis=UP, angle=PI / 2) self.add(sun, earth_orbit) self.play(Create(earth)) self.play(Rotate(earth, angle=TAU, axis=UP, about_point=sun.get_center()), run_time=5)User: Animation Request: change the color of the sun User: Animation Request: change the color of the sun Assistant: ```python from manim import *
class GenScene(ThreeDScene): def construct(self): self.set_camera_orientation(phi=75 * DEGREES, theta=30 * DEGREES)
sun = Sphere(radius=0.5, color=ORANGE).shift(ORIGIN) earth = Sphere(radius=0.2, color=BLUE).shift(RIGHT * 3) earth_orbit = Circle(radius=3, color=WHITE, fill_opacity=0).rotate_about_origin(axis=UP, angle=PI / 2) self.add(sun, earth_orbit) self.play(Create(earth)) self.play(Rotate(earth, angle=TAU, axis=UP, about_point=sun.get_center()), run_time=5)User: Animation Request: change the color of the sun, make video 3d User: Animation Request: change the color of the sun, make video 3d Assistant: ```python from manim import * class GenScene(ThreeDScene): def construct(self): self.set_camera_orientation(phi=75 * DEGREES, theta=30 * DEGREES) sun = Sphere(radius=0.5, color=PINK).shift(ORIGIN) earth = Sphere(radius=0.2, color=BLUE).shift(RIGHT * 3) earth_orbit = Circle(radius=3, color=WHITE, fill_opacity=0).rotate_about_origin(axis=UP, angle=PI / 2) self.add(sun, earth_orbit) self.play(Create(earth)) self.play(Rotate(earth, angle=TAU, axis=UP, about_point=sun.get_center()), run_time=5)User: Animation Request: change the color of the sun by orange, 3d User: Animation Request: change the color of the sun by orange, 3d Assistant: ```python from manim import *
class GenScene(ThreeDScene): def construct(self): self.set_camera_orientation(phi=75 * DEGREES, theta=30 * DEGREES)
sun = Sphere(radius=0.5, color=ORANGE).shift(ORIGIN) earth = Sphere(radius=0.2, color=BLUE).shift(RIGHT * 3) earth_orbit = Circle(radius=3, color=WHITE, fill_opacity=0).rotate_about_origin(axis=UP, angle=PI / 2) self.add(sun, earth_orbit) self.play(Create(earth)) self.play(Rotate(earth, angle=TAU, axis=UP, about_point=sun.get_center()), run_time=5)User: Animation Request: it's not changed yet, make the color of the sun orange, use other function, 3d User: Animation Request: it's not changed yet, make the color of the sun orange, use other function, 3d Assistant: ```pythonnfrom manim import *nnclass GenScene(ThreeDScene):n def construct(self):n self.set_camera_orientation(phi=75 * DEGREES, theta=30 * DEGREES)nn sun = Sphere(radius=0.5).shift(ORIGIN)n earth = Sphere(radius=0.2, color=BLUE).shift(RIGHT * 3)n earth_orbit = Circle(radius=3, color=WHITE, fill_opacity=0).rotate_about_origin(axis=UP, angle=PI / 2)n n self.add(earth_orbit)n self.play(Fill(sun, color=ORANGE))n self.play(Create(sun))n self.play(Create(earth))nn self.play(Rotate(earth, angle=TAU, axis=UP, about_point=sun.get_center()), run_time=5)n``` User: Animation Request: again, 3d User: Animation Request: again, 3d Assistant: ```python from manim import * class GenScene(ThreeDScene): def construct(self): self.set_camera_orientation(phi=75 * DEGREES, theta=30 * DEGREES) sun = Sphere(radius=0.5, color=ORANGE).shift(ORIGIN) earth = Sphere(radius=0.2, color=BLUE).shift(RIGHT * 3) earth_orbit = Circle(radius=3, color=WHITE, fill_opacity=0).rotate_about_origin(axis=UP, angle=PI / 2) self.add(sun, earth_orbit) self.play(Create(earth)) self.play(Rotate(earth, angle=TAU, axis=UP, about_point=sun.get_center()), run_time=5)User: Animation Request: use sphere.set_color, 3d User: Animation Request: use sphere.set_color, 3d Assistant: ```python from manim import *
class GenScene(ThreeDScene): def construct(self): self.set_camera_orientation(phi=75 * DEGREES, theta=30 * DEGREES)
sun = Sphere(radius=0.5).shift(ORIGIN) sun.set_color(ORANGE) earth = Sphere(radius=0.2, color=BLUE).shift(RIGHT * 3) earth_orbit = Circle(radius=3, color=WHITE, fill_opacity=0).rotate_about_origin(axis=UP, angle=PI / 2) self.add(sun, earth_orbit) self.play(Create(earth)) self.play(Rotate(earth, angle=TAU, axis=UP, about_point=sun.get_center()), run_time=5)User: Animation Request: make the ratio of the size more realistic User: Animation Request: make the ratio of the size more realistic Assistant: - Assistant
from manim import * class GenScene(ThreeDScene): def construct(self): self.set_camera_orientation(phi=75 * DEGREES, theta=30 * DEGREES) sun = Sphere(radius=0.5).shift(ORIGIN) # Using a smaller radius for representation sun.set_color(ORANGE) earth = Sphere(radius=0.05, color=BLUE).shift(RIGHT * 5) # Smaller size and greater distance earth_orbit = Circle(radius=5, color=WHITE, fill_opacity=0).rotate_about_origin(axis=UP, angle=PI / 2) # Larger orbit self.add(sun, earth_orbit) self.play(Create(earth)) self.play(Rotate(earth, angle=TAU, axis=UP, about_point=sun.get_center()), run_time=5)