Spaces:
Sleeping
Sleeping
up
Browse files
crazy_functions/数学动画生成manim.py
CHANGED
@@ -86,7 +86,7 @@ def 动画生成(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt
|
|
86 |
llm_kwargs=llm_kwargs, chatbot=chatbot, history=demo,
|
87 |
sys_prompt=
|
88 |
r"Write a animation script with 3blue1brown's manim. "+
|
89 |
-
r"Please begin with `from manim import
|
90 |
r"Answer me with a code block wrapped by ```."
|
91 |
)
|
92 |
chatbot.append(["开始生成动画", "..."])
|
@@ -106,8 +106,8 @@ def examples_of_manim():
|
|
106 |
|
107 |
|
108 |
```
|
109 |
-
|
110 |
-
class
|
111 |
def construct(self):
|
112 |
group = VGroup(Dot(LEFT), Dot(ORIGIN), Dot(RIGHT, color=RED), Dot(2 * RIGHT)).scale(1.4)
|
113 |
dest = Dot([4, 3, 0], color=YELLOW)
|
@@ -119,8 +119,8 @@ class MyAnimation(Scene):
|
|
119 |
|
120 |
|
121 |
```
|
122 |
-
|
123 |
-
class
|
124 |
def construct(self):
|
125 |
text=MathTex(
|
126 |
"\\frac{d}{dx}f(x)g(x)=","f(x)\\frac{d}{dx}g(x)","+",
|
@@ -143,8 +143,8 @@ class MyAnimation(Scene):
|
|
143 |
|
144 |
|
145 |
```
|
146 |
-
|
147 |
-
class
|
148 |
def construct(self):
|
149 |
path = VMobject()
|
150 |
dot = Dot()
|
@@ -161,5 +161,31 @@ class MyAnimation(Scene):
|
|
161 |
self.play(dot.animate.shift(LEFT))
|
162 |
self.wait()
|
163 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
```
|
165 |
"""
|
|
|
86 |
llm_kwargs=llm_kwargs, chatbot=chatbot, history=demo,
|
87 |
sys_prompt=
|
88 |
r"Write a animation script with 3blue1brown's manim. "+
|
89 |
+
r"Please begin with `from manim import *`. " +
|
90 |
r"Answer me with a code block wrapped by ```."
|
91 |
)
|
92 |
chatbot.append(["开始生成动画", "..."])
|
|
|
106 |
|
107 |
|
108 |
```
|
109 |
+
|
110 |
+
class MovingGroupToDestination(Scene):
|
111 |
def construct(self):
|
112 |
group = VGroup(Dot(LEFT), Dot(ORIGIN), Dot(RIGHT, color=RED), Dot(2 * RIGHT)).scale(1.4)
|
113 |
dest = Dot([4, 3, 0], color=YELLOW)
|
|
|
119 |
|
120 |
|
121 |
```
|
122 |
+
|
123 |
+
class LatexWithMovingFramebox(Scene):
|
124 |
def construct(self):
|
125 |
text=MathTex(
|
126 |
"\\frac{d}{dx}f(x)g(x)=","f(x)\\frac{d}{dx}g(x)","+",
|
|
|
143 |
|
144 |
|
145 |
```
|
146 |
+
|
147 |
+
class PointWithTrace(Scene):
|
148 |
def construct(self):
|
149 |
path = VMobject()
|
150 |
dot = Dot()
|
|
|
161 |
self.play(dot.animate.shift(LEFT))
|
162 |
self.wait()
|
163 |
|
164 |
+
```
|
165 |
+
|
166 |
+
```
|
167 |
+
|
168 |
+
# do not use get_graph, this funciton is deprecated
|
169 |
+
|
170 |
+
class ExampleFunctionGraph(Scene):
|
171 |
+
def construct(self):
|
172 |
+
cos_func = FunctionGraph(
|
173 |
+
lambda t: np.cos(t) + 0.5 * np.cos(7 * t) + (1 / 7) * np.cos(14 * t),
|
174 |
+
color=RED,
|
175 |
+
)
|
176 |
+
|
177 |
+
sin_func_1 = FunctionGraph(
|
178 |
+
lambda t: np.sin(t) + 0.5 * np.sin(7 * t) + (1 / 7) * np.sin(14 * t),
|
179 |
+
color=BLUE,
|
180 |
+
)
|
181 |
+
|
182 |
+
sin_func_2 = FunctionGraph(
|
183 |
+
lambda t: np.sin(t) + 0.5 * np.sin(7 * t) + (1 / 7) * np.sin(14 * t),
|
184 |
+
x_range=[-4, 4],
|
185 |
+
color=GREEN,
|
186 |
+
).move_to([0, 1, 0])
|
187 |
+
|
188 |
+
self.add(cos_func, sin_func_1, sin_func_2)
|
189 |
+
|
190 |
```
|
191 |
"""
|