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,177 @@
1
+ ---
2
+ name: styling
3
+ description: Fill, stroke, opacity and visual styling of mobjects
4
+ metadata:
5
+ tags: fill, stroke, opacity, style, width, appearance
6
+ ---
7
+
8
+ # Styling Mobjects
9
+
10
+ Control the visual appearance of mobjects with fill, stroke, and opacity settings.
11
+
12
+ ## Fill Properties
13
+
14
+ Fill controls the interior of shapes.
15
+
16
+ ```python
17
+ from manim import *
18
+
19
+ class FillExample(Scene):
20
+ def construct(self):
21
+ # Set fill on creation
22
+ circle = Circle(fill_color=BLUE, fill_opacity=0.8)
23
+
24
+ # Set fill after creation
25
+ square = Square()
26
+ square.set_fill(RED, opacity=0.5)
27
+
28
+ self.add(circle, square)
29
+ ```
30
+
31
+ ### Fill Methods
32
+ ```python
33
+ mobject.set_fill(color=RED) # Color only
34
+ mobject.set_fill(RED, opacity=0.5) # Color and opacity
35
+ mobject.set_fill(opacity=0.5) # Opacity only
36
+ mobject.set_fill_color(RED) # Color only (alternative)
37
+ mobject.set_fill_opacity(0.5) # Opacity only (alternative)
38
+ ```
39
+
40
+ ## Stroke Properties
41
+
42
+ Stroke controls the outline/border of shapes.
43
+
44
+ ```python
45
+ class StrokeExample(Scene):
46
+ def construct(self):
47
+ # Set stroke on creation
48
+ circle = Circle(stroke_color=BLUE, stroke_width=4)
49
+
50
+ # Set stroke after creation
51
+ square = Square()
52
+ square.set_stroke(RED, width=8)
53
+
54
+ self.add(circle, square)
55
+ ```
56
+
57
+ ### Stroke Methods
58
+ ```python
59
+ mobject.set_stroke(color=RED) # Color only
60
+ mobject.set_stroke(RED, width=4) # Color and width
61
+ mobject.set_stroke(width=4) # Width only
62
+ mobject.set_stroke(opacity=0.5) # Opacity only
63
+ mobject.set_stroke_color(RED) # Color only (alternative)
64
+ mobject.set_stroke_width(4) # Width only (alternative)
65
+ mobject.set_stroke_opacity(0.5) # Opacity only (alternative)
66
+ ```
67
+
68
+ ### Stroke Width Reference
69
+ ```python
70
+ # Common stroke widths
71
+ DEFAULT_STROKE_WIDTH = 4
72
+ thin = 1
73
+ normal = 4
74
+ thick = 8
75
+ very_thick = 12
76
+ ```
77
+
78
+ ## Combined Styling
79
+
80
+ ```python
81
+ class CombinedStyling(Scene):
82
+ def construct(self):
83
+ square = Square()
84
+ square.set_fill(BLUE, opacity=0.5)
85
+ square.set_stroke(YELLOW, width=6)
86
+ self.add(square)
87
+ ```
88
+
89
+ ### Method Chaining
90
+ ```python
91
+ square = Square().set_fill(RED, 0.5).set_stroke(WHITE, 4)
92
+ ```
93
+
94
+ ## The set_style Method
95
+
96
+ Set multiple style properties at once:
97
+
98
+ ```python
99
+ square = Square()
100
+ square.set_style(
101
+ fill_color=BLUE,
102
+ fill_opacity=0.5,
103
+ stroke_color=WHITE,
104
+ stroke_width=4,
105
+ stroke_opacity=1
106
+ )
107
+ ```
108
+
109
+ ## Opacity
110
+
111
+ Control transparency of mobjects:
112
+
113
+ ```python
114
+ # Overall opacity
115
+ mobject.set_opacity(0.5) # Affects both fill and stroke
116
+
117
+ # Separate opacities
118
+ mobject.set_fill_opacity(0.8)
119
+ mobject.set_stroke_opacity(0.3)
120
+
121
+ # Fade effect
122
+ mobject.fade(0.5) # 0.5 = 50% faded (opposite of opacity)
123
+ ```
124
+
125
+ ## Background Rectangle
126
+
127
+ Add a background behind text or other mobjects:
128
+
129
+ ```python
130
+ class BackgroundExample(Scene):
131
+ def construct(self):
132
+ text = Text("Important!")
133
+ bg = BackgroundRectangle(text, fill_opacity=0.8, buff=0.1)
134
+ group = VGroup(bg, text)
135
+ self.add(group)
136
+ ```
137
+
138
+ ## Applying Style to Submobjects
139
+
140
+ ```python
141
+ # Apply to all submobjects (family=True, default)
142
+ group.set_fill(RED, opacity=0.5, family=True)
143
+
144
+ # Apply only to parent, not submobjects
145
+ group.set_fill(RED, opacity=0.5, family=False)
146
+ ```
147
+
148
+ ## Style Based on Position
149
+
150
+ ```python
151
+ class GradientFill(Scene):
152
+ def construct(self):
153
+ squares = VGroup(*[Square() for _ in range(5)]).arrange(RIGHT)
154
+
155
+ for i, sq in enumerate(squares):
156
+ opacity = (i + 1) / 5
157
+ sq.set_fill(BLUE, opacity=opacity)
158
+
159
+ self.add(squares)
160
+ ```
161
+
162
+ ## Copying Style
163
+
164
+ ```python
165
+ # Copy style from another mobject
166
+ source = Circle().set_fill(RED, 0.5).set_stroke(WHITE, 4)
167
+ target = Square()
168
+ target.match_style(source) # Now has same fill and stroke
169
+ ```
170
+
171
+ ## Best Practices
172
+
173
+ 1. **Use fill_opacity for shapes** - Fully opaque fills can hide other elements
174
+ 2. **Consistent stroke width** - Pick a width and stick with it
175
+ 3. **Contrast fill and stroke** - Different colors help definition
176
+ 4. **Use BackgroundRectangle for readability** - Behind text on busy backgrounds
177
+ 5. **Chain methods for concise code** - But break lines if too long
@@ -0,0 +1,222 @@
1
+ ---
2
+ name: text-animations
3
+ description: Write, AddTextLetterByLetter, TypeWithCursor text animations
4
+ metadata:
5
+ tags: text, write, typing, letter, cursor, animation
6
+ ---
7
+
8
+ # Text Animations
9
+
10
+ Animations specifically designed for text and equations.
11
+
12
+ ## Write
13
+
14
+ The most common text animation. Simulates handwriting.
15
+
16
+ ```python
17
+ from manim import *
18
+
19
+ class WriteExample(Scene):
20
+ def construct(self):
21
+ text = Text("Hello World")
22
+ equation = MathTex(r"E = mc^2")
23
+
24
+ self.play(Write(text))
25
+ self.wait()
26
+ self.play(Write(equation))
27
+ ```
28
+
29
+ ### Write Parameters
30
+
31
+ ```python
32
+ self.play(Write(
33
+ text,
34
+ run_time=2, # Override auto-calculated time
35
+ rate_func=linear, # Timing curve
36
+ reverse=False, # Write backwards if True
37
+ ))
38
+ ```
39
+
40
+ Write automatically adjusts `run_time` based on text length.
41
+
42
+ ## AddTextLetterByLetter
43
+
44
+ Types text one character at a time.
45
+
46
+ ```python
47
+ class LetterByLetterExample(Scene):
48
+ def construct(self):
49
+ text = Text("Typing effect")
50
+
51
+ self.play(AddTextLetterByLetter(
52
+ text,
53
+ time_per_char=0.1 # Speed of typing
54
+ ))
55
+ ```
56
+
57
+ **Note:** Only works with `Text`, not `MathTex`.
58
+
59
+ ## RemoveTextLetterByLetter
60
+
61
+ Reverse of AddTextLetterByLetter - removes character by character.
62
+
63
+ ```python
64
+ class RemoveLetterByLetter(Scene):
65
+ def construct(self):
66
+ text = Text("Disappearing text")
67
+ self.add(text)
68
+
69
+ self.play(RemoveTextLetterByLetter(
70
+ text,
71
+ time_per_char=0.05
72
+ ))
73
+ ```
74
+
75
+ ## TypeWithCursor
76
+
77
+ Types text with a visible cursor.
78
+
79
+ ```python
80
+ class TypeWithCursorExample(Scene):
81
+ def construct(self):
82
+ text = Text("Typing with cursor")
83
+
84
+ # Create cursor
85
+ cursor = Rectangle(
86
+ color=GREY_A,
87
+ fill_color=GREY_A,
88
+ fill_opacity=1.0,
89
+ height=1.1,
90
+ width=0.1,
91
+ )
92
+
93
+ self.play(TypeWithCursor(text, cursor))
94
+
95
+ # Optional: blink cursor after typing
96
+ self.play(Blink(cursor, blinks=3))
97
+ ```
98
+
99
+ ### Cursor Customization
100
+
101
+ ```python
102
+ # Line cursor
103
+ cursor = Line(UP * 0.5, DOWN * 0.5, color=WHITE, stroke_width=2)
104
+
105
+ # Block cursor
106
+ cursor = Rectangle(width=0.5, height=1, fill_opacity=0.8, color=WHITE)
107
+
108
+ # Custom cursor position
109
+ self.play(TypeWithCursor(
110
+ text,
111
+ cursor,
112
+ buff=0.05, # Space between text and cursor
113
+ keep_cursor_y=True, # Keep cursor at consistent height
114
+ leave_cursor_on=True # Show cursor after animation
115
+ ))
116
+ ```
117
+
118
+ ## Blink (for cursors)
119
+
120
+ ```python
121
+ class BlinkExample(Scene):
122
+ def construct(self):
123
+ cursor = Rectangle(height=1, width=0.1, fill_opacity=1)
124
+ self.add(cursor)
125
+
126
+ self.play(Blink(cursor, blinks=5, time_on=0.3, time_off=0.3))
127
+ ```
128
+
129
+ ## Word by Word Animation
130
+
131
+ Using LaggedStart for word-by-word appearance:
132
+
133
+ ```python
134
+ class WordByWord(Scene):
135
+ def construct(self):
136
+ # Split into individual Text objects
137
+ words = VGroup(
138
+ Text("Hello"),
139
+ Text("World"),
140
+ Text("!")
141
+ ).arrange(RIGHT, buff=0.3)
142
+
143
+ self.play(LaggedStart(
144
+ *[Write(word) for word in words],
145
+ lag_ratio=0.5
146
+ ))
147
+ ```
148
+
149
+ ## Equation Transformations
150
+
151
+ Animate between equations:
152
+
153
+ ```python
154
+ class EquationTransform(Scene):
155
+ def construct(self):
156
+ eq1 = MathTex(r"a^2 + b^2 = c^2")
157
+ eq2 = MathTex(r"c = \sqrt{a^2 + b^2}")
158
+
159
+ self.play(Write(eq1))
160
+ self.wait()
161
+ self.play(TransformMatchingTex(eq1, eq2))
162
+ ```
163
+
164
+ ## Highlighting Text
165
+
166
+ ```python
167
+ class HighlightText(Scene):
168
+ def construct(self):
169
+ text = Text("Important message")
170
+ self.add(text)
171
+
172
+ # Circumscribe (draw around)
173
+ self.play(Circumscribe(text, color=YELLOW))
174
+
175
+ # Indicate (pulse)
176
+ self.play(Indicate(text, color=RED))
177
+
178
+ # Flash
179
+ self.play(Flash(text.get_center(), color=WHITE))
180
+ ```
181
+
182
+ ## Replacing Text
183
+
184
+ ```python
185
+ class ReplaceText(Scene):
186
+ def construct(self):
187
+ text1 = Text("Before")
188
+ text2 = Text("After")
189
+
190
+ self.play(Write(text1))
191
+ self.wait()
192
+
193
+ # Transform text
194
+ self.play(Transform(text1, text2))
195
+
196
+ # Or replacement transform
197
+ self.play(ReplacementTransform(text1, text2))
198
+ ```
199
+
200
+ ## Colored Text Animation
201
+
202
+ ```python
203
+ class ColoredTextAnimation(Scene):
204
+ def construct(self):
205
+ text = Text("Colorful")
206
+ self.play(Write(text))
207
+
208
+ # Animate color change per letter
209
+ self.play(LaggedStart(
210
+ *[char.animate.set_color(random_bright_color()) for char in text],
211
+ lag_ratio=0.1
212
+ ))
213
+ ```
214
+
215
+ ## Best Practices
216
+
217
+ 1. **Use Write for most text** - Natural and smooth
218
+ 2. **Use AddTextLetterByLetter for "typing" effect** - Terminal/code aesthetics
219
+ 3. **Use TypeWithCursor for interactive feel** - Good for tutorials
220
+ 4. **Use TransformMatchingTex for equations** - Smooth mathematical transitions
221
+ 5. **Adjust time_per_char for pacing** - 0.05-0.1 is usually good
222
+ 6. **Only use Text (not MathTex) for letter-by-letter** - API limitation
@@ -0,0 +1,189 @@
1
+ ---
2
+ name: text
3
+ description: Text mobjects, fonts, and text styling in Manim
4
+ metadata:
5
+ tags: text, font, typography, markup, paragraph
6
+ ---
7
+
8
+ # Text in Manim
9
+
10
+ The `Text` class renders text using Pango/Cairo, supporting various fonts and styles.
11
+
12
+ ## Basic Text
13
+
14
+ ```python
15
+ from manim import *
16
+
17
+ class TextExample(Scene):
18
+ def construct(self):
19
+ text = Text("Hello World")
20
+ self.play(Write(text))
21
+ ```
22
+
23
+ ## Text Parameters
24
+
25
+ ```python
26
+ text = Text(
27
+ "Hello World",
28
+ font_size=48, # Size (default: 48)
29
+ color=BLUE, # Text color
30
+ font="Arial", # Font family
31
+ weight=BOLD, # NORMAL, BOLD, etc.
32
+ slant=ITALIC, # NORMAL, ITALIC, OBLIQUE
33
+ line_spacing=1.5, # Space between lines
34
+ )
35
+ ```
36
+
37
+ ## Font Size
38
+
39
+ ```python
40
+ # Using font_size parameter
41
+ small = Text("Small", font_size=24)
42
+ medium = Text("Medium", font_size=48)
43
+ large = Text("Large", font_size=72)
44
+
45
+ # Using scale after creation
46
+ text = Text("Hello").scale(2)
47
+ ```
48
+
49
+ ## Custom Fonts
50
+
51
+ ```python
52
+ # Use any installed system font
53
+ text = Text("Custom Font", font="Comic Sans MS")
54
+ text = Text("Monospace", font="Courier New")
55
+ text = Text("Serif", font="Times New Roman")
56
+ ```
57
+
58
+ ## Text Styling with MarkupText
59
+
60
+ Use Pango markup for mixed styling within one Text object:
61
+
62
+ ```python
63
+ class MarkupExample(Scene):
64
+ def construct(self):
65
+ text = MarkupText(
66
+ f'all in red <span fgcolor="{YELLOW}">except this</span>',
67
+ color=RED
68
+ )
69
+ self.play(Write(text))
70
+ ```
71
+
72
+ ### Available Markup Tags
73
+
74
+ ```python
75
+ # Bold and italic
76
+ text = MarkupText('<b>Bold</b> and <i>Italic</i>')
77
+
78
+ # Colors using fgcolor
79
+ text = MarkupText('<span fgcolor="yellow">Yellow</span>')
80
+
81
+ # Subscripts and superscripts
82
+ text = MarkupText('H<sub>2</sub>O and x<sup>2</sup>')
83
+
84
+ # Font size
85
+ text = MarkupText('<big>Big</big> and <small>small</small>')
86
+
87
+ # Underline and strikethrough
88
+ text = MarkupText('<u>Underline</u> and <s>Strike</s>')
89
+
90
+ # Double underline with color
91
+ text = MarkupText('<span underline="double" underline_color="green">text</span>')
92
+
93
+ # Monospace
94
+ text = MarkupText('type <tt>help</tt> for help')
95
+ ```
96
+
97
+ ### Gradients in MarkupText
98
+
99
+ ```python
100
+ # Global gradient
101
+ text = MarkupText("nice gradient", gradient=(BLUE, GREEN))
102
+
103
+ # Inline gradient
104
+ text = MarkupText(
105
+ 'nice <gradient from="RED" to="YELLOW">colored</gradient> text'
106
+ )
107
+ ```
108
+
109
+ ### Escaping Special Characters
110
+
111
+ ```python
112
+ # Must escape these characters:
113
+ # > as &gt;
114
+ # < as &lt;
115
+ # & as &amp;
116
+ text = MarkupText("5 &gt; 3 and 2 &lt; 4")
117
+ ```
118
+
119
+ ## Multi-line Text
120
+
121
+ ```python
122
+ # Using \n for line breaks
123
+ text = Text("Line 1\nLine 2\nLine 3")
124
+
125
+ # Using Paragraph for better control
126
+ from manim import Paragraph
127
+
128
+ para = Paragraph(
129
+ "This is a longer text",
130
+ "that spans multiple lines",
131
+ "with automatic alignment",
132
+ line_spacing=0.5
133
+ )
134
+ ```
135
+
136
+ ## Coloring Parts of Text
137
+
138
+ ```python
139
+ class ColoredText(Scene):
140
+ def construct(self):
141
+ text = Text("Hello World")
142
+ text[0:5].set_color(RED) # "Hello" in red
143
+ text[6:11].set_color(BLUE) # "World" in blue
144
+ self.play(Write(text))
145
+ ```
146
+
147
+ ## Text with Gradients
148
+
149
+ ```python
150
+ text = Text("Gradient Text")
151
+ text.set_color_by_gradient(RED, YELLOW, GREEN)
152
+ ```
153
+
154
+ ## Accessing Characters
155
+
156
+ ```python
157
+ text = Text("ABCDE")
158
+
159
+ # Individual characters
160
+ text[0] # 'A'
161
+ text[1] # 'B'
162
+
163
+ # Slices
164
+ text[0:3] # 'ABC'
165
+ text[-1] # 'E'
166
+
167
+ # Iterate
168
+ for char in text:
169
+ char.set_color(random_color())
170
+ ```
171
+
172
+ ## Text Positioning
173
+
174
+ ```python
175
+ # Standard positioning methods work
176
+ text = Text("Hello")
177
+ text.to_edge(UP)
178
+ text.to_corner(UL)
179
+ text.move_to(ORIGIN)
180
+ text.next_to(other_mobject, DOWN)
181
+ ```
182
+
183
+ ## Best Practices
184
+
185
+ 1. **Use Text for regular text** - Simple and fast
186
+ 2. **Use MarkupText for mixed styles** - When you need multiple colors/weights
187
+ 3. **Use MathTex for math** - Text doesn't render LaTeX
188
+ 4. **Install fonts system-wide** - Manim uses system fonts
189
+ 5. **Keep font_size consistent** - Use the same size for related text