manim-mcp 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/README.md +104 -0
  2. package/dist/demo.mp4 +0 -0
  3. package/dist/index.js +65 -0
  4. package/dist/mcp-app.html +142 -0
  5. package/dist/server.js +1492 -0
  6. package/package.json +67 -0
  7. package/references/composer/SKILL.md +154 -0
  8. package/references/composer/references/3b1b-series-patterns.md +217 -0
  9. package/references/composer/references/domain-planning-guides/calculus-planning.md +188 -0
  10. package/references/composer/references/domain-planning-guides/linear-algebra-planning.md +169 -0
  11. package/references/composer/references/domain-planning-guides/ml-planning.md +286 -0
  12. package/references/composer/references/domain-planning-guides/number-theory-planning.md +187 -0
  13. package/references/composer/references/domain-planning-guides/physics-planning.md +249 -0
  14. package/references/composer/references/domain-planning-guides/probability-planning.md +200 -0
  15. package/references/composer/references/mathematical-storytelling.md +359 -0
  16. package/references/composer/references/narrative-patterns.md +221 -0
  17. package/references/composer/references/opening-patterns.md +284 -0
  18. package/references/composer/references/pacing-guide.md +289 -0
  19. package/references/composer/references/scene-archetypes.md +534 -0
  20. package/references/composer/references/scene-examples.md +379 -0
  21. package/references/composer/references/visual-techniques.md +480 -0
  22. package/references/composer/templates/scenes-template.md +147 -0
  23. package/references/manimce/SKILL.md +166 -0
  24. package/references/manimce/examples/3d_visualization.py +373 -0
  25. package/references/manimce/examples/basic_animations.py +212 -0
  26. package/references/manimce/examples/graph_plotting.py +401 -0
  27. package/references/manimce/examples/lorenz_attractor.py +172 -0
  28. package/references/manimce/examples/math_visualization.py +315 -0
  29. package/references/manimce/examples/updater_patterns.py +369 -0
  30. package/references/manimce/rules/3b1b-translation.md +594 -0
  31. package/references/manimce/rules/3d.md +254 -0
  32. package/references/manimce/rules/advanced-animations.md +594 -0
  33. package/references/manimce/rules/animation-groups.md +212 -0
  34. package/references/manimce/rules/animations.md +128 -0
  35. package/references/manimce/rules/api-pitfalls.md +89 -0
  36. package/references/manimce/rules/axes.md +214 -0
  37. package/references/manimce/rules/camera.md +208 -0
  38. package/references/manimce/rules/cli.md +232 -0
  39. package/references/manimce/rules/color-conventions.md +444 -0
  40. package/references/manimce/rules/colors.md +199 -0
  41. package/references/manimce/rules/config.md +264 -0
  42. package/references/manimce/rules/creation-animations.md +158 -0
  43. package/references/manimce/rules/graphing.md +233 -0
  44. package/references/manimce/rules/grouping.md +220 -0
  45. package/references/manimce/rules/latex.md +202 -0
  46. package/references/manimce/rules/lines.md +241 -0
  47. package/references/manimce/rules/long-form-video.md +552 -0
  48. package/references/manimce/rules/mathematical-domains.md +689 -0
  49. package/references/manimce/rules/mobjects.md +116 -0
  50. package/references/manimce/rules/multi-scene-composition.md +112 -0
  51. package/references/manimce/rules/pedagogy.md +532 -0
  52. package/references/manimce/rules/physics-simulations.md +610 -0
  53. package/references/manimce/rules/positioning.md +211 -0
  54. package/references/manimce/rules/scenes.md +121 -0
  55. package/references/manimce/rules/shapes.md +300 -0
  56. package/references/manimce/rules/styling.md +177 -0
  57. package/references/manimce/rules/text-animations.md +222 -0
  58. package/references/manimce/rules/text.md +189 -0
  59. package/references/manimce/rules/timing.md +227 -0
  60. package/references/manimce/rules/transform-animations.md +157 -0
  61. package/references/manimce/rules/updaters.md +226 -0
  62. package/references/manimce/templates/basic_scene.py +64 -0
  63. package/references/manimce/templates/camera_scene.py +100 -0
  64. package/references/manimce/templates/threed_scene.py +138 -0
@@ -0,0 +1,264 @@
1
+ ---
2
+ name: config
3
+ description: Configuration system, manim.cfg, and settings
4
+ metadata:
5
+ tags: config, configuration, settings, manim.cfg, options
6
+ ---
7
+
8
+ # Configuration
9
+
10
+ Configure Manim's behavior through files and code.
11
+
12
+ ## Configuration Hierarchy
13
+
14
+ Manim reads configuration from (in order of precedence):
15
+ 1. Command-line arguments (highest priority)
16
+ 2. User's `manim.cfg` in current directory
17
+ 3. User's global config
18
+ 4. Default values (lowest priority)
19
+
20
+ ## manim.cfg File
21
+
22
+ Create a `manim.cfg` file in your project directory:
23
+
24
+ ```ini
25
+ [CLI]
26
+ # Preview after rendering
27
+ preview = True
28
+
29
+ # Default quality
30
+ quality = medium_quality
31
+
32
+ # Output format
33
+ format = mp4
34
+
35
+ # Frame rate
36
+ frame_rate = 30
37
+
38
+ [output]
39
+ # Custom output directory
40
+ media_dir = ./media
41
+
42
+ # Save last frame as PNG
43
+ save_last_frame = False
44
+
45
+ [renderer]
46
+ # Background color
47
+ background_color = BLACK
48
+
49
+ [style]
50
+ # Default font
51
+ font = Arial
52
+ ```
53
+
54
+ ## Common Configuration Options
55
+
56
+ ### CLI Section
57
+
58
+ ```ini
59
+ [CLI]
60
+ # Quality presets: low_quality, medium_quality, high_quality, production_quality, fourk_quality
61
+ quality = medium_quality
62
+
63
+ # Preview video after rendering
64
+ preview = True
65
+
66
+ # Frame rate
67
+ frame_rate = 30
68
+
69
+ # Output format: mp4, gif, mov, webm, png
70
+ format = mp4
71
+
72
+ # Transparent background
73
+ transparent = False
74
+
75
+ # Progress bar: display, leave, none
76
+ progress_bar = display
77
+ ```
78
+
79
+ ### Rendering Section
80
+
81
+ ```ini
82
+ [renderer]
83
+ # Background color (hex or color name)
84
+ background_color = #1e1e1e
85
+
86
+ # Renderer type: cairo, opengl
87
+ renderer = cairo
88
+ ```
89
+
90
+ ### Resolution
91
+
92
+ ```ini
93
+ [CLI]
94
+ # Frame dimensions
95
+ pixel_width = 1920
96
+ pixel_height = 1080
97
+ ```
98
+
99
+ ## Programmatic Configuration
100
+
101
+ Access and modify config in your Python code:
102
+
103
+ ```python
104
+ # Access config values
105
+ config.pixel_width # e.g., 1920
106
+ config.frame_rate # e.g., 30
107
+ config.background_color # e.g., BLACK
108
+
109
+ # Modify config (before creating scenes)
110
+ config.pixel_width = 1920
111
+ config.pixel_height = 1080
112
+ config.frame_rate = 60
113
+ config.background_color = BLUE_E
114
+ ```
115
+
116
+ ### In Scene
117
+
118
+ ```python
119
+ class MyScene(Scene):
120
+ def construct(self):
121
+ # Access frame dimensions
122
+ width = config.frame_width
123
+ height = config.frame_height
124
+
125
+ # Create rectangle matching frame size
126
+ frame_rect = Rectangle(
127
+ width=width,
128
+ height=height,
129
+ stroke_color=WHITE
130
+ )
131
+ self.add(frame_rect)
132
+ ```
133
+
134
+ ## Background Color
135
+
136
+ ### In Config File
137
+
138
+ ```ini
139
+ [renderer]
140
+ background_color = BLACK
141
+ # Or hex color
142
+ background_color = #1a1a2e
143
+ ```
144
+
145
+ ### In Code
146
+
147
+ ```python
148
+ class DarkBackground(Scene):
149
+ def construct(self):
150
+ self.camera.background_color = "#1a1a2e"
151
+ # ... rest of scene
152
+ ```
153
+
154
+ ## Output Directory Structure
155
+
156
+ Default media directory structure:
157
+ ```
158
+ media/
159
+ ├── videos/
160
+ │ └── scene_file/
161
+ │ ├── 480p15/ # Low quality
162
+ │ ├── 720p30/ # Medium quality
163
+ │ ├── 1080p60/ # High quality
164
+ │ └── 2160p60/ # 4K quality
165
+ ├── images/
166
+ │ └── scene_file/
167
+ │ └── SceneName.png
168
+ └── Tex/ # LaTeX cache
169
+ ```
170
+
171
+ ### Custom Output Directory
172
+
173
+ ```ini
174
+ [output]
175
+ media_dir = ./output
176
+ ```
177
+
178
+ Or via CLI:
179
+ ```bash
180
+ manim --media_dir ./output file.py Scene
181
+ ```
182
+
183
+ ## Tex Configuration
184
+
185
+ For LaTeX rendering:
186
+
187
+ ```ini
188
+ [tex]
189
+ # Custom preamble
190
+ preamble = \usepackage{amsmath}\usepackage{amssymb}
191
+
192
+ # Tex compiler
193
+ tex_compiler = latex
194
+ ```
195
+
196
+ ## Caching
197
+
198
+ ```ini
199
+ [CLI]
200
+ # Disable caching (useful for debugging)
201
+ disable_caching = True
202
+
203
+ # Max cached files
204
+ max_files_cached = 100
205
+ ```
206
+
207
+ ## Viewing Current Config
208
+
209
+ ```bash
210
+ # Show all config values
211
+ manim cfg show
212
+
213
+ # Show specific section
214
+ manim cfg show CLI
215
+
216
+ # Write current config to file
217
+ manim cfg write
218
+ ```
219
+
220
+ ## Project-Specific Config
221
+
222
+ Create `manim.cfg` in your project root:
223
+
224
+ ```ini
225
+ [CLI]
226
+ quality = high_quality
227
+ preview = True
228
+ frame_rate = 60
229
+
230
+ [renderer]
231
+ background_color = #0d1117
232
+
233
+ [output]
234
+ media_dir = ./renders
235
+ ```
236
+
237
+ ## Plugins
238
+
239
+ Manim has an extensible plugin system:
240
+
241
+ ```bash
242
+ # List installed plugins
243
+ manim plugins -l
244
+
245
+ # Install a plugin
246
+ pip install manim-pluginname
247
+ ```
248
+
249
+ Enable plugins in `manim.cfg`:
250
+
251
+ ```ini
252
+ [CLI]
253
+ plugins = manim-pluginname
254
+ # For multiple plugins:
255
+ plugins = plugin1,plugin2
256
+ ```
257
+
258
+ ## Best Practices
259
+
260
+ 1. **Use manim.cfg for project defaults** - Consistent settings across team
261
+ 2. **Keep quality low during development** - Faster iteration
262
+ 3. **Set background_color in config** - Not in every scene
263
+ 4. **Use custom media_dir** - Keep renders organized
264
+ 5. **Commit manim.cfg to version control** - Share settings with collaborators
@@ -0,0 +1,158 @@
1
+ ---
2
+ name: creation-animations
3
+ description: Create, Write, FadeIn, DrawBorderThenFill and other creation animations
4
+ metadata:
5
+ tags: create, write, fadein, fadeout, grow, shrink, uncreate
6
+ ---
7
+
8
+ # Creation Animations
9
+
10
+ Animations that introduce mobjects to the scene.
11
+
12
+ ## Create
13
+
14
+ Draws a VMobject progressively along its path.
15
+
16
+ ```python
17
+ from manim import *
18
+
19
+ class CreateExample(Scene):
20
+ def construct(self):
21
+ circle = Circle()
22
+ self.play(Create(circle))
23
+ ```
24
+
25
+ Best for: Geometric shapes, lines, arrows.
26
+
27
+ ## Write
28
+
29
+ Simulates handwriting. Best for text and equations.
30
+
31
+ ```python
32
+ class WriteExample(Scene):
33
+ def construct(self):
34
+ text = Text("Hello World")
35
+ equation = MathTex(r"E = mc^2")
36
+
37
+ self.play(Write(text))
38
+ self.wait()
39
+ self.play(Write(equation))
40
+ ```
41
+
42
+ Write automatically sets appropriate timing based on text length.
43
+
44
+ ## DrawBorderThenFill
45
+
46
+ Draws the outline first, then fills in the shape.
47
+
48
+ ```python
49
+ class DrawBorderExample(Scene):
50
+ def construct(self):
51
+ square = Square(fill_opacity=0.8, color=BLUE)
52
+ self.play(DrawBorderThenFill(square))
53
+ ```
54
+
55
+ Best for: Shapes with fills where you want to emphasize the outline first.
56
+
57
+ ## FadeIn / FadeOut
58
+
59
+ Simple opacity transitions.
60
+
61
+ ```python
62
+ class FadeExample(Scene):
63
+ def construct(self):
64
+ circle = Circle()
65
+
66
+ # Fade in
67
+ self.play(FadeIn(circle))
68
+ self.wait()
69
+
70
+ # Fade out
71
+ self.play(FadeOut(circle))
72
+ ```
73
+
74
+ ### Directional Fades
75
+
76
+ ```python
77
+ # Fade in from a direction
78
+ self.play(FadeIn(square, shift=UP)) # Fade in while moving up
79
+ self.play(FadeIn(square, shift=LEFT)) # Fade in from right
80
+
81
+ # Fade out to a direction
82
+ self.play(FadeOut(square, shift=DOWN)) # Fade out while moving down
83
+ ```
84
+
85
+ ### Scale Fades
86
+
87
+ ```python
88
+ self.play(FadeIn(circle, scale=0.5)) # Fade in while growing
89
+ self.play(FadeOut(circle, scale=2)) # Fade out while shrinking
90
+ ```
91
+
92
+ ## GrowFromCenter / ShrinkToCenter
93
+
94
+ ```python
95
+ class GrowExample(Scene):
96
+ def construct(self):
97
+ circle = Circle()
98
+
99
+ self.play(GrowFromCenter(circle))
100
+ self.wait()
101
+ self.play(ShrinkToCenter(circle))
102
+ ```
103
+
104
+ ## GrowFromPoint
105
+
106
+ Grow from a specific point.
107
+
108
+ ```python
109
+ self.play(GrowFromPoint(circle, ORIGIN))
110
+ self.play(GrowFromPoint(circle, LEFT * 3))
111
+ ```
112
+
113
+ ## GrowFromEdge
114
+
115
+ Grow from a specific edge.
116
+
117
+ ```python
118
+ self.play(GrowFromEdge(square, LEFT)) # Grow from left edge
119
+ self.play(GrowFromEdge(square, DOWN)) # Grow from bottom edge
120
+ ```
121
+
122
+ ## SpinInFromNothing
123
+
124
+ Object spins in while growing.
125
+
126
+ ```python
127
+ self.play(SpinInFromNothing(circle))
128
+ ```
129
+
130
+ ## Uncreate
131
+
132
+ Reverse of Create - erases the mobject.
133
+
134
+ ```python
135
+ self.play(Create(circle))
136
+ self.wait()
137
+ self.play(Uncreate(circle)) # Erases in reverse
138
+ ```
139
+
140
+ ## AddTextLetterByLetter
141
+
142
+ Types text one character at a time.
143
+
144
+ ```python
145
+ class TypingExample(Scene):
146
+ def construct(self):
147
+ text = Text("Hello World")
148
+ self.play(AddTextLetterByLetter(text, time_per_char=0.1))
149
+ ```
150
+
151
+ Note: Only works with `Text`, not `MathTex`.
152
+
153
+ ## Best Practices
154
+
155
+ 1. **Use Write for text** - Looks more natural than Create
156
+ 2. **Use Create for shapes** - Clean progressive drawing
157
+ 3. **Use FadeIn for quick introductions** - When drawing isn't important
158
+ 4. **Match removal to creation** - If you Create, use Uncreate; if FadeIn, use FadeOut
@@ -0,0 +1,233 @@
1
+ ---
2
+ name: graphing
3
+ description: Plotting functions, parametric curves, and data visualization
4
+ metadata:
5
+ tags: plot, graph, function, parametric, curve, data
6
+ ---
7
+
8
+ # Graphing Functions
9
+
10
+ Plot mathematical functions and curves.
11
+
12
+ ## Plotting Functions on Axes
13
+
14
+ ```python
15
+ from manim import *
16
+
17
+ class BasicPlot(Scene):
18
+ def construct(self):
19
+ axes = Axes(x_range=[-3, 3], y_range=[-2, 8])
20
+
21
+ # Plot a function
22
+ graph = axes.plot(lambda x: x**2, color=BLUE)
23
+
24
+ self.add(axes, graph)
25
+ ```
26
+
27
+ ## plot() Parameters
28
+
29
+ ```python
30
+ class PlotParameters(Scene):
31
+ def construct(self):
32
+ axes = Axes(x_range=[-5, 5], y_range=[-2, 2])
33
+
34
+ graph = axes.plot(
35
+ lambda x: np.sin(x),
36
+ x_range=[-PI, PI], # Limit domain
37
+ color=YELLOW,
38
+ stroke_width=4,
39
+ )
40
+
41
+ self.add(axes, graph)
42
+ ```
43
+
44
+ ## Multiple Functions
45
+
46
+ ```python
47
+ class MultiplePlots(Scene):
48
+ def construct(self):
49
+ axes = Axes(x_range=[-3, 3], y_range=[-2, 10])
50
+
51
+ sin_graph = axes.plot(lambda x: np.sin(x), color=BLUE)
52
+ cos_graph = axes.plot(lambda x: np.cos(x), color=RED)
53
+ quad_graph = axes.plot(lambda x: x**2, color=GREEN)
54
+
55
+ self.add(axes, sin_graph, cos_graph, quad_graph)
56
+ ```
57
+
58
+ ## Adding Labels to Graphs
59
+
60
+ ```python
61
+ class GraphLabels(Scene):
62
+ def construct(self):
63
+ axes = Axes(x_range=[-3, 3], y_range=[-2, 10])
64
+ graph = axes.plot(lambda x: x**2, color=BLUE)
65
+
66
+ # Add label to graph
67
+ label = axes.get_graph_label(
68
+ graph,
69
+ label=MathTex("y = x^2"),
70
+ x_val=2,
71
+ direction=UR
72
+ )
73
+
74
+ self.add(axes, graph, label)
75
+ ```
76
+
77
+ ## Parametric Curves
78
+
79
+ Plot curves defined by parametric equations.
80
+
81
+ ```python
82
+ class ParametricExample(Scene):
83
+ def construct(self):
84
+ axes = Axes(x_range=[-3, 3], y_range=[-3, 3])
85
+
86
+ # Circle: x = cos(t), y = sin(t)
87
+ curve = axes.plot_parametric_curve(
88
+ lambda t: np.array([np.cos(t), np.sin(t), 0]),
89
+ t_range=[0, 2 * PI],
90
+ color=YELLOW
91
+ )
92
+
93
+ self.add(axes, curve)
94
+ ```
95
+
96
+ ### Parametric Curve Examples
97
+
98
+ ```python
99
+ # Lissajous curve
100
+ curve = axes.plot_parametric_curve(
101
+ lambda t: np.array([np.sin(3*t), np.sin(2*t), 0]),
102
+ t_range=[0, 2*PI],
103
+ )
104
+
105
+ # Spiral
106
+ curve = axes.plot_parametric_curve(
107
+ lambda t: np.array([t*np.cos(t), t*np.sin(t), 0]),
108
+ t_range=[0, 4*PI],
109
+ )
110
+
111
+ # Heart curve
112
+ curve = axes.plot_parametric_curve(
113
+ lambda t: np.array([
114
+ 16 * np.sin(t)**3,
115
+ 13*np.cos(t) - 5*np.cos(2*t) - 2*np.cos(3*t) - np.cos(4*t),
116
+ 0
117
+ ]) / 10,
118
+ t_range=[0, 2*PI],
119
+ )
120
+ ```
121
+
122
+ ## ParametricFunction (standalone)
123
+
124
+ Create parametric curves without axes:
125
+
126
+ ```python
127
+ class StandaloneParametric(Scene):
128
+ def construct(self):
129
+ curve = ParametricFunction(
130
+ lambda t: np.array([np.cos(t), np.sin(t), 0]),
131
+ t_range=[0, 2*PI],
132
+ color=BLUE
133
+ )
134
+ self.add(curve)
135
+ ```
136
+
137
+ ## Area Under Curve
138
+
139
+ ```python
140
+ class AreaUnderCurve(Scene):
141
+ def construct(self):
142
+ axes = Axes(x_range=[-1, 5], y_range=[-1, 10])
143
+ graph = axes.plot(lambda x: x**2, x_range=[0, 3], color=BLUE)
144
+
145
+ # Shade area under curve
146
+ area = axes.get_area(
147
+ graph,
148
+ x_range=[0, 2],
149
+ color=BLUE,
150
+ opacity=0.5
151
+ )
152
+
153
+ self.add(axes, graph, area)
154
+ ```
155
+
156
+ ## Riemann Rectangles
157
+
158
+ ```python
159
+ class RiemannRectangles(Scene):
160
+ def construct(self):
161
+ axes = Axes(x_range=[-1, 5], y_range=[-1, 10])
162
+ graph = axes.plot(lambda x: x**2, color=BLUE)
163
+
164
+ rects = axes.get_riemann_rectangles(
165
+ graph,
166
+ x_range=[0, 3],
167
+ dx=0.5,
168
+ color=YELLOW,
169
+ stroke_width=1
170
+ )
171
+
172
+ self.add(axes, graph, rects)
173
+ ```
174
+
175
+ ## Animated Graphing
176
+
177
+ ```python
178
+ class AnimatedGraph(Scene):
179
+ def construct(self):
180
+ axes = Axes(x_range=[-3, 3], y_range=[-2, 2])
181
+ self.add(axes)
182
+
183
+ graph = axes.plot(lambda x: np.sin(x), color=BLUE)
184
+
185
+ # Animate the graph being drawn
186
+ self.play(Create(graph), run_time=3)
187
+ ```
188
+
189
+ ## Moving Point on Graph
190
+
191
+ ```python
192
+ class MovingPointOnGraph(Scene):
193
+ def construct(self):
194
+ axes = Axes(x_range=[-3, 3], y_range=[-2, 2])
195
+ graph = axes.plot(lambda x: np.sin(x), color=BLUE)
196
+
197
+ # Point that follows graph
198
+ x_tracker = ValueTracker(-3)
199
+
200
+ dot = always_redraw(lambda: Dot(
201
+ axes.i2gp(x_tracker.get_value(), graph),
202
+ color=YELLOW
203
+ ))
204
+
205
+ self.add(axes, graph, dot)
206
+ self.play(x_tracker.animate.set_value(3), run_time=4)
207
+ ```
208
+
209
+ ## 3D Surface Plots
210
+
211
+ ```python
212
+ class SurfacePlot(ThreeDScene):
213
+ def construct(self):
214
+ axes = ThreeDAxes()
215
+
216
+ surface = axes.plot_surface(
217
+ lambda u, v: np.sin(u) * np.cos(v),
218
+ u_range=[-PI, PI],
219
+ v_range=[-PI, PI],
220
+ colorscale=[BLUE, GREEN, YELLOW],
221
+ )
222
+
223
+ self.set_camera_orientation(phi=75*DEGREES, theta=-45*DEGREES)
224
+ self.add(axes, surface)
225
+ ```
226
+
227
+ ## Best Practices
228
+
229
+ 1. **Set x_range on plot for discontinuities** - Avoid graphing undefined regions
230
+ 2. **Use get_graph_label for clarity** - Label functions on the graph
231
+ 3. **Match graph color to concept** - Consistent color coding
232
+ 4. **Use i2gp for points on graphs** - Automatically handles conversion
233
+ 5. **Animate graph creation** - More engaging than static display