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,211 @@
1
+ ---
2
+ name: positioning
3
+ description: move_to, next_to, align_to, shift and positioning methods
4
+ metadata:
5
+ tags: position, move_to, next_to, shift, align, layout
6
+ ---
7
+
8
+ # Positioning in Manim
9
+
10
+ Methods for placing and moving mobjects in the scene.
11
+
12
+ ## Coordinate System
13
+
14
+ Manim uses a coordinate system where:
15
+ - Origin (0, 0, 0) is at the center of the screen
16
+ - X-axis: LEFT (-) to RIGHT (+)
17
+ - Y-axis: DOWN (-) to UP (+)
18
+ - Z-axis: IN (-) to OUT (+) (for 3D)
19
+
20
+ ### Direction Constants
21
+ ```python
22
+ UP = np.array([0, 1, 0])
23
+ DOWN = np.array([0, -1, 0])
24
+ LEFT = np.array([-1, 0, 0])
25
+ RIGHT = np.array([1, 0, 0])
26
+ ORIGIN = np.array([0, 0, 0])
27
+
28
+ # Diagonals
29
+ UL = UP + LEFT # Upper left
30
+ UR = UP + RIGHT # Upper right
31
+ DL = DOWN + LEFT # Lower left
32
+ DR = DOWN + RIGHT # Lower right
33
+ ```
34
+
35
+ ## move_to
36
+
37
+ Move to an absolute position.
38
+
39
+ ```python
40
+ from manim import *
41
+
42
+ class MoveToExample(Scene):
43
+ def construct(self):
44
+ circle = Circle()
45
+
46
+ # Move to origin
47
+ circle.move_to(ORIGIN)
48
+
49
+ # Move to specific coordinates
50
+ circle.move_to(RIGHT * 2 + UP * 1)
51
+
52
+ # Move to another mobject's position
53
+ square = Square().shift(LEFT * 2)
54
+ circle.move_to(square)
55
+
56
+ # Move to a specific point of another mobject
57
+ circle.move_to(square.get_top())
58
+ ```
59
+
60
+ ## shift
61
+
62
+ Move relative to current position.
63
+
64
+ ```python
65
+ class ShiftExample(Scene):
66
+ def construct(self):
67
+ circle = Circle()
68
+
69
+ # Shift in one direction
70
+ circle.shift(RIGHT)
71
+ circle.shift(UP * 2)
72
+
73
+ # Shift in multiple directions
74
+ circle.shift(RIGHT * 2 + UP * 1)
75
+
76
+ # Chain shifts
77
+ circle.shift(LEFT).shift(DOWN)
78
+ ```
79
+
80
+ ## next_to
81
+
82
+ Position relative to another mobject.
83
+
84
+ ```python
85
+ class NextToExample(Scene):
86
+ def construct(self):
87
+ square = Square()
88
+ circle = Circle()
89
+ triangle = Triangle()
90
+
91
+ # Place circle to the right of square
92
+ circle.next_to(square, RIGHT)
93
+
94
+ # With buffer (spacing)
95
+ triangle.next_to(square, DOWN, buff=0.5)
96
+
97
+ # Aligned to specific edge
98
+ circle.next_to(square, RIGHT, aligned_edge=UP)
99
+ ```
100
+
101
+ ### buff Parameter
102
+ ```python
103
+ # Default buffer
104
+ circle.next_to(square, RIGHT) # Uses DEFAULT_MOBJECT_TO_MOBJECT_BUFFER
105
+
106
+ # Custom buffer
107
+ circle.next_to(square, RIGHT, buff=0) # No gap
108
+ circle.next_to(square, RIGHT, buff=1) # 1 unit gap
109
+ circle.next_to(square, RIGHT, buff=0.5) # Half unit gap
110
+ ```
111
+
112
+ ## align_to
113
+
114
+ Align edges with another mobject.
115
+
116
+ ```python
117
+ class AlignToExample(Scene):
118
+ def construct(self):
119
+ square = Square().shift(LEFT)
120
+ circle = Circle().shift(RIGHT)
121
+
122
+ # Align circle's left edge with square's left edge
123
+ circle.align_to(square, LEFT)
124
+
125
+ # Align tops
126
+ circle.align_to(square, UP)
127
+
128
+ # Align to a point
129
+ circle.align_to(ORIGIN, DOWN)
130
+ ```
131
+
132
+ ## Edge Methods
133
+
134
+ Position at screen edges.
135
+
136
+ ```python
137
+ class EdgeExample(Scene):
138
+ def construct(self):
139
+ # To screen edges
140
+ text1 = Text("Top").to_edge(UP)
141
+ text2 = Text("Bottom").to_edge(DOWN)
142
+ text3 = Text("Left").to_edge(LEFT)
143
+ text4 = Text("Right").to_edge(RIGHT)
144
+
145
+ # With buffer
146
+ text5 = Text("Buffered").to_edge(UP, buff=1)
147
+ ```
148
+
149
+ ## Corner Methods
150
+
151
+ Position at screen corners.
152
+
153
+ ```python
154
+ class CornerExample(Scene):
155
+ def construct(self):
156
+ t1 = Text("UL").to_corner(UL)
157
+ t2 = Text("UR").to_corner(UR)
158
+ t3 = Text("DL").to_corner(DL)
159
+ t4 = Text("DR").to_corner(DR)
160
+
161
+ # With buffer
162
+ t5 = Text("Buffered").to_corner(UL, buff=0.5)
163
+ ```
164
+
165
+ ## center
166
+
167
+ Center on screen or another mobject.
168
+
169
+ ```python
170
+ mobject.center() # Center on screen
171
+ mobject.center_on(other) # Center on another mobject (custom helper)
172
+ ```
173
+
174
+ ## Getting Positions
175
+
176
+ ```python
177
+ circle = Circle()
178
+
179
+ # Get various points
180
+ circle.get_center() # Center point
181
+ circle.get_top() # Top edge center
182
+ circle.get_bottom() # Bottom edge center
183
+ circle.get_left() # Left edge center
184
+ circle.get_right() # Right edge center
185
+ circle.get_corner(UL) # Upper left corner
186
+ circle.get_corner(DR) # Lower right corner
187
+ circle.get_start() # Start of path
188
+ circle.get_end() # End of path
189
+ ```
190
+
191
+ ## Animated Positioning
192
+
193
+ ```python
194
+ class AnimatedPosition(Scene):
195
+ def construct(self):
196
+ square = Square()
197
+ self.add(square)
198
+
199
+ # Animate movement
200
+ self.play(square.animate.shift(RIGHT * 2))
201
+ self.play(square.animate.move_to(UP * 2))
202
+ self.play(square.animate.to_edge(LEFT))
203
+ ```
204
+
205
+ ## Best Practices
206
+
207
+ 1. **Use next_to for relative positioning** - Maintains relationships
208
+ 2. **Use move_to for absolute positioning** - Precise coordinates
209
+ 3. **Use shift for relative adjustments** - Quick tweaks
210
+ 4. **Use to_edge/to_corner for screen positioning** - Responsive layouts
211
+ 5. **Adjust buff for visual spacing** - Don't let elements crowd
@@ -0,0 +1,121 @@
1
+ ---
2
+ name: scenes
3
+ description: Scene structure, construct method, and scene types in Manim
4
+ metadata:
5
+ tags: scene, construct, setup, render, ThreeDScene, MovingCameraScene
6
+ ---
7
+
8
+ # Scenes in Manim
9
+
10
+ A Scene is the canvas where all animations take place. Every Manim animation is defined within a Scene class.
11
+
12
+ ## Basic Scene Structure
13
+
14
+ All animation code resides within the `construct()` method of a Scene subclass.
15
+
16
+ ```python
17
+ from manim import *
18
+
19
+ class MyScene(Scene):
20
+ def construct(self):
21
+ circle = Circle()
22
+ self.play(Create(circle))
23
+ self.wait(1)
24
+ ```
25
+
26
+ ## Scene Lifecycle Methods
27
+
28
+ ### construct()
29
+ The main method where you define your animation. Called automatically when rendering.
30
+
31
+ ### setup()
32
+ Called before `construct()`. Use for initialization that should happen before animation logic.
33
+
34
+ ```python
35
+ class MyScene(Scene):
36
+ def setup(self):
37
+ self.camera.background_color = BLUE_E
38
+
39
+ def construct(self):
40
+ circle = Circle()
41
+ self.play(Create(circle))
42
+ ```
43
+
44
+ ## Scene Methods
45
+
46
+ ### Adding and Removing Objects
47
+
48
+ ```python
49
+ # Add without animation (instant)
50
+ self.add(mobject)
51
+ self.add(mobject1, mobject2, mobject3)
52
+
53
+ # Remove without animation
54
+ self.remove(mobject)
55
+
56
+ # Clear all mobjects
57
+ self.clear()
58
+ ```
59
+
60
+ ### Playing Animations
61
+
62
+ ```python
63
+ # Play a single animation
64
+ self.play(Create(circle))
65
+
66
+ # Play multiple animations simultaneously
67
+ self.play(Create(circle), FadeIn(square))
68
+
69
+ # With run_time
70
+ self.play(Create(circle), run_time=2)
71
+ ```
72
+
73
+ ### Waiting
74
+
75
+ ```python
76
+ # Wait for 1 second (default)
77
+ self.wait()
78
+
79
+ # Wait for specific duration
80
+ self.wait(2)
81
+ ```
82
+
83
+ ## Scene Types
84
+
85
+ ### Scene (Default)
86
+ Standard 2D scene for most animations.
87
+
88
+ ### ThreeDScene
89
+ For 3D animations with camera orientation control.
90
+
91
+ ```python
92
+ class My3DScene(ThreeDScene):
93
+ def construct(self):
94
+ self.set_camera_orientation(phi=75 * DEGREES, theta=-45 * DEGREES)
95
+ axes = ThreeDAxes()
96
+ sphere = Sphere()
97
+ self.add(axes, sphere)
98
+ ```
99
+
100
+ ### MovingCameraScene
101
+ For animations that require camera movement (zoom, pan).
102
+
103
+ ```python
104
+ class ZoomScene(MovingCameraScene):
105
+ def construct(self):
106
+ circle = Circle()
107
+ self.add(circle)
108
+ self.play(self.camera.frame.animate.scale(0.5).move_to(circle))
109
+ ```
110
+
111
+ ## Multiple Scenes in One File
112
+
113
+ Render specific scene:
114
+ ```bash
115
+ manim -pql file.py Scene1
116
+ ```
117
+
118
+ Render all scenes:
119
+ ```bash
120
+ manim -pql -a file.py
121
+ ```
@@ -0,0 +1,300 @@
1
+ ---
2
+ name: shapes
3
+ description: Circle, Square, Rectangle, Polygon and geometric primitives
4
+ metadata:
5
+ tags: shapes, circle, square, rectangle, polygon, geometry
6
+ ---
7
+
8
+ # Geometric Shapes
9
+
10
+ Basic geometric primitives in Manim.
11
+
12
+ ## Circle
13
+
14
+ ```python
15
+ from manim import *
16
+
17
+ class CircleExample(Scene):
18
+ def construct(self):
19
+ # Default circle
20
+ c1 = Circle()
21
+
22
+ # With parameters
23
+ c2 = Circle(
24
+ radius=2,
25
+ color=BLUE,
26
+ fill_opacity=0.5,
27
+ stroke_width=4
28
+ )
29
+
30
+ self.add(c1, c2)
31
+ ```
32
+
33
+ ### Circle Methods
34
+
35
+ ```python
36
+ circle = Circle()
37
+
38
+ # Get properties
39
+ circle.get_radius()
40
+ circle.get_center()
41
+
42
+ # Create from points
43
+ Circle.from_three_points(p1, p2, p3)
44
+
45
+ # Surround another mobject
46
+ triangle = Triangle()
47
+ circle = Circle().surround(triangle) # Circle wraps around triangle
48
+ circle = Circle().surround(triangle, buffer_factor=1.5) # With padding
49
+ circle = Circle().surround(triangle, stretch=True) # Stretch to fit
50
+ ```
51
+
52
+ ## Ellipse
53
+
54
+ ```python
55
+ class EllipseExample(Scene):
56
+ def construct(self):
57
+ ellipse = Ellipse(
58
+ width=4,
59
+ height=2,
60
+ color=GREEN
61
+ )
62
+ self.add(ellipse)
63
+ ```
64
+
65
+ ## Square
66
+
67
+ ```python
68
+ class SquareExample(Scene):
69
+ def construct(self):
70
+ # Default square
71
+ s1 = Square()
72
+
73
+ # With parameters
74
+ s2 = Square(
75
+ side_length=2,
76
+ color=RED,
77
+ fill_opacity=0.8
78
+ )
79
+
80
+ self.add(s1, s2)
81
+ ```
82
+
83
+ ## Rectangle
84
+
85
+ ```python
86
+ class RectangleExample(Scene):
87
+ def construct(self):
88
+ rect = Rectangle(
89
+ width=4,
90
+ height=2,
91
+ color=YELLOW,
92
+ fill_opacity=0.5
93
+ )
94
+ self.add(rect)
95
+ ```
96
+
97
+ ### RoundedRectangle
98
+
99
+ ```python
100
+ class RoundedRectExample(Scene):
101
+ def construct(self):
102
+ rounded = RoundedRectangle(
103
+ width=4,
104
+ height=2,
105
+ corner_radius=0.5,
106
+ color=BLUE,
107
+ fill_opacity=0.8
108
+ )
109
+ self.add(rounded)
110
+ ```
111
+
112
+ ## Triangle
113
+
114
+ ```python
115
+ class TriangleExample(Scene):
116
+ def construct(self):
117
+ # Equilateral triangle
118
+ tri = Triangle(color=PURPLE)
119
+
120
+ # Custom triangle (using Polygon)
121
+ custom_tri = Polygon(
122
+ ORIGIN, RIGHT * 2, UP * 3,
123
+ color=GREEN
124
+ )
125
+
126
+ self.add(tri, custom_tri.shift(RIGHT * 3))
127
+ ```
128
+
129
+ ## Polygon
130
+
131
+ Create any polygon from vertices.
132
+
133
+ ```python
134
+ class PolygonExample(Scene):
135
+ def construct(self):
136
+ # Pentagon
137
+ pentagon = RegularPolygon(n=5, color=ORANGE)
138
+
139
+ # Hexagon
140
+ hexagon = RegularPolygon(n=6, color=TEAL)
141
+
142
+ # Custom polygon
143
+ custom = Polygon(
144
+ [-2, -1, 0],
145
+ [2, -1, 0],
146
+ [2, 1, 0],
147
+ [0, 2, 0],
148
+ [-2, 1, 0],
149
+ color=PINK
150
+ )
151
+
152
+ VGroup(pentagon, hexagon, custom).arrange(RIGHT, buff=1)
153
+ self.add(pentagon, hexagon, custom)
154
+ ```
155
+
156
+ ## RegularPolygon
157
+
158
+ ```python
159
+ class RegularPolygonExamples(Scene):
160
+ def construct(self):
161
+ shapes = VGroup(
162
+ RegularPolygon(n=3), # Triangle
163
+ RegularPolygon(n=4), # Square
164
+ RegularPolygon(n=5), # Pentagon
165
+ RegularPolygon(n=6), # Hexagon
166
+ RegularPolygon(n=8), # Octagon
167
+ ).arrange(RIGHT)
168
+ self.add(shapes)
169
+ ```
170
+
171
+ ## Star
172
+
173
+ ```python
174
+ class StarExample(Scene):
175
+ def construct(self):
176
+ star = Star(
177
+ n=5, # Number of points
178
+ outer_radius=2,
179
+ inner_radius=1, # Optional: auto-calculated if not specified
180
+ density=2, # How vertices connect (affects shape)
181
+ color=YELLOW,
182
+ fill_opacity=1
183
+ )
184
+ self.add(star)
185
+
186
+ # Different densities create different star patterns
187
+ star_d2 = Star(7, outer_radius=2, density=2, color=RED)
188
+ star_d3 = Star(7, outer_radius=2, density=3, color=PURPLE)
189
+ ```
190
+
191
+ ## RegularPolygram
192
+
193
+ Star-like shapes with vertices connected by density.
194
+
195
+ ```python
196
+ class PolygramExample(Scene):
197
+ def construct(self):
198
+ # Pentagram (5-pointed star pattern)
199
+ pentagram = RegularPolygram(5, radius=2)
200
+ self.add(pentagram)
201
+ ```
202
+
203
+ ## Annulus (Ring)
204
+
205
+ ```python
206
+ class AnnulusExample(Scene):
207
+ def construct(self):
208
+ ring = Annulus(
209
+ inner_radius=1,
210
+ outer_radius=2,
211
+ color=BLUE,
212
+ fill_opacity=0.5
213
+ )
214
+ self.add(ring)
215
+ ```
216
+
217
+ ## Sector and Arc
218
+
219
+ ```python
220
+ class SectorArcExample(Scene):
221
+ def construct(self):
222
+ # Sector (pie slice)
223
+ sector = Sector(
224
+ radius=2,
225
+ angle=PI/2,
226
+ start_angle=0,
227
+ color=RED,
228
+ fill_opacity=0.8
229
+ ).shift(LEFT * 2)
230
+
231
+ # Arc (just the curve)
232
+ arc = Arc(
233
+ radius=2,
234
+ angle=PI/2,
235
+ start_angle=PI,
236
+ color=BLUE
237
+ ).shift(RIGHT * 2)
238
+
239
+ self.add(sector, arc)
240
+ ```
241
+
242
+ ## ArcBetweenPoints
243
+
244
+ ```python
245
+ class ArcBetweenPointsExample(Scene):
246
+ def construct(self):
247
+ arc = ArcBetweenPoints(
248
+ start=LEFT * 2,
249
+ end=RIGHT * 2,
250
+ angle=PI/2, # Curvature
251
+ color=GREEN
252
+ )
253
+ self.add(arc)
254
+ ```
255
+
256
+ ## Dot
257
+
258
+ ```python
259
+ class DotExample(Scene):
260
+ def construct(self):
261
+ # Default dot
262
+ d1 = Dot()
263
+
264
+ # Customized
265
+ d2 = Dot(
266
+ point=RIGHT * 2,
267
+ radius=0.2,
268
+ color=YELLOW
269
+ )
270
+
271
+ self.add(d1, d2)
272
+ ```
273
+
274
+ ## Common Shape Operations
275
+
276
+ ```python
277
+ shape = Square()
278
+
279
+ # Transform
280
+ shape.scale(2)
281
+ shape.rotate(PI/4)
282
+ shape.stretch(2, dim=0) # Stretch horizontally
283
+
284
+ # Style
285
+ shape.set_fill(RED, opacity=0.5)
286
+ shape.set_stroke(WHITE, width=4)
287
+
288
+ # Position
289
+ shape.move_to(ORIGIN)
290
+ shape.shift(UP * 2)
291
+ shape.next_to(other, RIGHT)
292
+ ```
293
+
294
+ ## Best Practices
295
+
296
+ 1. **Use RegularPolygon for regular shapes** - More precise than manual Polygon
297
+ 2. **Set fill_opacity for visibility** - Default is often 0 (transparent)
298
+ 3. **Use Dot for points** - Better than Circle with small radius
299
+ 4. **Use RoundedRectangle for UI elements** - More polished look
300
+ 5. **Combine shapes with VGroup** - For complex figures