This commit is contained in:
qingxu fu 2023-05-25 12:39:41 +08:00
parent fad502a938
commit ed53442942

View File

@ -86,7 +86,7 @@ def 动画生成(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt
llm_kwargs=llm_kwargs, chatbot=chatbot, history=demo,
sys_prompt=
r"Write a animation script with 3blue1brown's manim. "+
r"Please begin with `from manim import *` and name the class as `MyAnimation`. " +
r"Please begin with `from manim import *`. " +
r"Answer me with a code block wrapped by ```."
)
chatbot.append(["开始生成动画", "..."])
@ -106,8 +106,8 @@ def examples_of_manim():
```
# Moving Group To Destination
class MyAnimation(Scene):
class MovingGroupToDestination(Scene):
def construct(self):
group = VGroup(Dot(LEFT), Dot(ORIGIN), Dot(RIGHT, color=RED), Dot(2 * RIGHT)).scale(1.4)
dest = Dot([4, 3, 0], color=YELLOW)
@ -119,8 +119,8 @@ class MyAnimation(Scene):
```
# Plot function and moving framebox
class MyAnimation(Scene):
class LatexWithMovingFramebox(Scene):
def construct(self):
text=MathTex(
"\\frac{d}{dx}f(x)g(x)=","f(x)\\frac{d}{dx}g(x)","+",
@ -143,8 +143,8 @@ class MyAnimation(Scene):
```
# Point With Trace
class MyAnimation(Scene):
class PointWithTrace(Scene):
def construct(self):
path = VMobject()
dot = Dot()
@ -161,5 +161,31 @@ class MyAnimation(Scene):
self.play(dot.animate.shift(LEFT))
self.wait()
```
```
# do not use get_graph, this funciton is deprecated
class ExampleFunctionGraph(Scene):
def construct(self):
cos_func = FunctionGraph(
lambda t: np.cos(t) + 0.5 * np.cos(7 * t) + (1 / 7) * np.cos(14 * t),
color=RED,
)
sin_func_1 = FunctionGraph(
lambda t: np.sin(t) + 0.5 * np.sin(7 * t) + (1 / 7) * np.sin(14 * t),
color=BLUE,
)
sin_func_2 = FunctionGraph(
lambda t: np.sin(t) + 0.5 * np.sin(7 * t) + (1 / 7) * np.sin(14 * t),
x_range=[-4, 4],
color=GREEN,
).move_to([0, 1, 0])
self.add(cos_func, sin_func_1, sin_func_2)
```
"""