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,249 @@
1
+ # Physics Video Planning Guide
2
+
3
+ Based on the Differential Equations series (2019), Optics Puzzles (2023), Cosmic Distance (2025), Hairy Ball Theorem (2026), and physics-related content across the 3b1b codebase.
4
+
5
+ ---
6
+
7
+ ## Core Visual Language
8
+
9
+ ### Phase Space (THE Physics Visualization)
10
+
11
+ The dual representation -- physical system on one side, phase portrait on the other -- is 3b1b's signature approach to physics.
12
+
13
+ **From `_2019/diffyq/part1/`:**
14
+ ```python
15
+ # Physical space: pendulum swinging
16
+ pendulum = Pendulum(length=3, initial_theta=PI/4)
17
+
18
+ # Phase space: theta vs omega
19
+ phase_plane = NumberPlane(
20
+ x_range=[-PI, PI], # theta
21
+ y_range=[-5, 5], # angular velocity
22
+ )
23
+
24
+ # Link: dot on phase space tracks pendulum state
25
+ state_dot = Dot(color=YELLOW)
26
+ state_dot.add_updater(lambda m: m.move_to(
27
+ phase_plane.c2p(pendulum.theta, pendulum.omega)
28
+ ))
29
+ ```
30
+
31
+ ### Vector Fields and Stream Lines
32
+
33
+ ```python
34
+ # From _2021/matrix_exp.py
35
+ stream_lines = StreamLines(func, x_range=(-4, 4), y_range=(-4, 4))
36
+ animated_lines = AnimatedStreamLines(stream_lines)
37
+ ```
38
+
39
+ Stream lines show how solutions flow through phase space. Use `AnimatedStreamLines` for dynamic, flowing visualization.
40
+
41
+ ### Physical Simulations
42
+
43
+ Key simulation patterns from the codebase:
44
+
45
+ **Spring-Mass System** (`_2025/laplace/shm.py`):
46
+ ```python
47
+ class SrpingMassSystem(VGroup):
48
+ def time_step(self, delta_t, dt_size=1e-3):
49
+ state = [self.get_x(), self.velocity]
50
+ for _ in range(sub_steps):
51
+ x, v = state
52
+ state += np.array([v, self.get_force(x, v)]) * true_dt
53
+ ```
54
+
55
+ **SIR Epidemic** (`_2020/sir.py`):
56
+ ```python
57
+ class Person(VGroup):
58
+ CONFIG = {
59
+ "infection_radius": 0.5,
60
+ "infection_duration": 5,
61
+ "recovery_probability": 0.5,
62
+ }
63
+ # Physics-based movement with infection mechanics
64
+ ```
65
+
66
+ **Sliding Blocks** (`_2019/clacks/question.py`):
67
+ ```python
68
+ class SlidingBlocks(VGroup):
69
+ # Two blocks, elastic collisions
70
+ # Mass ratio determines number of collisions
71
+ ```
72
+
73
+ ---
74
+
75
+ ## Topic Planning
76
+
77
+ ### Differential Equations
78
+
79
+ **Series structure (from `_2019/diffyq/`):**
80
+
81
+ Part 1: Pendulum (ODE) -> Phase space -> Vector field
82
+ Part 2: Heat equation (PDE) -> Temperature evolution
83
+ Part 3: Solving heat equation -> Boundary conditions -> Fourier's insight
84
+ Part 4: Fourier series -> Rotating vectors -> Complex exponentials
85
+ Part 5: Euler's formula as rotational dynamics
86
+
87
+ **Planning a DiffEq video:**
88
+ 1. Start with the PHYSICAL SYSTEM, not the equation
89
+ 2. Show the system evolving in time
90
+ 3. Ask "how would you describe this mathematically?"
91
+ 4. Derive the ODE from the physics
92
+ 5. Show the phase portrait as a map of all possible behaviors
93
+ 6. Vector field reveals the structure
94
+
95
+ **File organization pattern:**
96
+ ```
97
+ diffyq/partN/
98
+ pendulum.py (or physics simulation)
99
+ phase_space.py (phase portrait visualization)
100
+ staging.py (main scene assembly)
101
+ pi_scenes.py (TeacherStudentsScene interludes)
102
+ wordy_scenes.py (text-heavy explanation scenes)
103
+ shared_constructs.py (constants, helpers)
104
+ ```
105
+
106
+ ### Wave Physics / Optics
107
+
108
+ **From `_2023/optics_puzzles/`:**
109
+
110
+ **`OscillatingWave`** -- Time-varying parametric wave:
111
+ ```python
112
+ class OscillatingWave(VMobject):
113
+ wave_func = lambda x, t: amplitude * np.cos(TAU * x / wavelength - TAU * freq * t)
114
+ # Updater-driven: wave updates every frame
115
+ ```
116
+
117
+ **`SlicedWave`** -- Wave with per-layer phase kicks (for explaining index of refraction):
118
+ ```python
119
+ class SlicedWave(OscillatingWave):
120
+ phase_kicks = [0.1, 0.2, ...] # Phase shift per material layer
121
+ ```
122
+
123
+ **`ChargedParticle`** -- Particle with position history:
124
+ ```python
125
+ class ChargedParticle(Group):
126
+ # Tracks position history for field visualization
127
+ self.history.append(self.get_center().copy())
128
+ ```
129
+
130
+ **Spectral color mapping:**
131
+ ```python
132
+ def get_spectral_color(wavelength):
133
+ cmap = colormaps["Spectral"]
134
+ return Color(rgb=cmap(normalized_wavelength)[:3])
135
+ ```
136
+
137
+ **Planning an optics video:**
138
+ 1. Show the physical wave phenomenon
139
+ 2. Slow down time to see individual oscillations
140
+ 3. Show superposition (adding wave heights at each point)
141
+ 4. Introduce phasor diagrams for analysis
142
+ 5. Connect to the mathematical formula
143
+
144
+ ### Celestial Mechanics / Cosmic Distance
145
+
146
+ **From `_2025/cosmic_distance/`:**
147
+
148
+ **Textured celestial bodies:**
149
+ ```python
150
+ earth = TexturedSurface(Sphere(radius=r), "EarthTextureMap", "NightEarthTextureMap")
151
+ sun = TexturedSurface(Sphere(radius=r), "SunTexture")
152
+ ```
153
+
154
+ **3D star fields:**
155
+ ```python
156
+ stars = GlowDots(points, radius=...) # Depth-based sizing
157
+ ```
158
+
159
+ **Parallax visualization:**
160
+ Show Earth at two points in its orbit, observe how nearby stars shift against distant background.
161
+
162
+ ### Topology / Hairy Ball Theorem
163
+
164
+ **From `_2026/hairy_ball/`:**
165
+
166
+ **Fibonacci sphere sampling:**
167
+ ```python
168
+ def fibonacci_sphere(n_points=1000):
169
+ golden_ratio = (1 + math.sqrt(5)) / 2
170
+ # Evenly distributed points on sphere surface
171
+ ```
172
+
173
+ **Stereographic projection:**
174
+ ```python
175
+ def stereographic_proj(point):
176
+ x, y, z = point
177
+ return np.array([x / (1 - z), y / (1 - z), 0])
178
+ ```
179
+
180
+ **`SphereStreamLines`**: Vector field constrained to sphere surface, visualizing the impossibility of combing a hairy ball flat.
181
+
182
+ ---
183
+
184
+ ## Simulation Design Patterns
185
+
186
+ ### The Three Simulation Speeds
187
+
188
+ 1. **Full animation** (first few iterations): Every step shown with transitions
189
+ 2. **Quick animation** (middle iterations): Simplified, faster
190
+ 3. **Instant** (final iterations): Jump to result
191
+
192
+ ```python
193
+ for n in range(total):
194
+ if n < 5:
195
+ self.run_step(animated=True, run_time=2)
196
+ elif n < 20:
197
+ self.run_step(animated=True, run_time=0.5)
198
+ else:
199
+ self.run_step(animated=False)
200
+ ```
201
+
202
+ ### Physics Integration
203
+
204
+ For accurate physics simulations, use sub-stepping:
205
+ ```python
206
+ def time_step(self, delta_t, dt_size=1e-3):
207
+ sub_steps = int(delta_t / dt_size)
208
+ for _ in range(sub_steps):
209
+ x, v = state
210
+ force = self.get_force(x, v)
211
+ state += np.array([v, force]) * dt_size
212
+ ```
213
+
214
+ ### Sound Effects
215
+
216
+ For physical simulations, sound adds tangibility:
217
+ ```python
218
+ self.add_sound("clack") # Collision sound in Galton board
219
+ ```
220
+
221
+ ---
222
+
223
+ ## Color Conventions for Physics
224
+
225
+ | Element | Color | Context |
226
+ |---------|-------|---------|
227
+ | Time domain / time variable | BLUE | Laplace series |
228
+ | Frequency domain / s variable | YELLOW | Laplace series |
229
+ | Force / acceleration | RED | Mechanics |
230
+ | Velocity | GREEN | Mechanics |
231
+ | Position | BLUE | Mechanics |
232
+ | Electric field | YELLOW | Optics |
233
+ | Magnetic field | MAROON | EM waves |
234
+ | Positive charge | RED | Electrostatics |
235
+ | Negative charge | BLUE | Electrostatics |
236
+ | SIR: Susceptible | BLUE | Epidemiology |
237
+ | SIR: Infected | RED | Epidemiology |
238
+ | SIR: Recovered | GREEN | Epidemiology |
239
+
240
+ ---
241
+
242
+ ## Common Pitfalls in Physics Videos
243
+
244
+ 1. **Starting with the equation**: Show the physical system FIRST. The equation emerges from observation.
245
+ 2. **Ignoring phase space**: For any dynamical system, the phase portrait is more informative than the time series. Show both.
246
+ 3. **Static diagrams for dynamic systems**: Use updaters and simulations. Physics IS motion.
247
+ 4. **Not connecting to familiar experience**: "Imagine pushing a swing" is better than "consider a forced harmonic oscillator."
248
+ 5. **Mixing 2D and 3D carelessly**: If a concept is inherently 3D (EM waves, orbital mechanics), use 3D scenes with proper camera work. Don't flatten it.
249
+ 6. **Skipping the "tourist's guide" approach**: For survey-style physics videos, explicitly say "we won't prove this rigorously" -- this frees you to build intuition.
@@ -0,0 +1,200 @@
1
+ # Probability Video Planning Guide
2
+
3
+ Based on the Bayesian reasoning series (2019-2020), Beta distribution series (2020), CLT series (2023), Essentials of Probability (2018), and related content.
4
+
5
+ ---
6
+
7
+ ## Core Visual Language
8
+
9
+ ### Population Grids
10
+
11
+ The fundamental probability visual: a grid of people/dots/icons where subsets are colored differently.
12
+
13
+ **From `_2020/med_test.py`:**
14
+ ```python
15
+ class Population:
16
+ # Grid of people colored by disease status and test result
17
+ # Susceptible=one color, Infected=another
18
+ # Correct test results=bright, incorrect=muted
19
+ ```
20
+
21
+ **From Bayes videos:** Pi creature grids where each creature represents a member of the population.
22
+
23
+ ### Bar Charts / Histograms
24
+
25
+ **`ChartBars`** from `_2023/clt/main.py` and **`Histogram`** from `_2020/beta/helpers.py`:
26
+ ```python
27
+ bars = ChartBars(axes, values)
28
+ bars.set_submobject_colors_by_gradient(BLUE, GREEN)
29
+ ```
30
+
31
+ **Dynamic updating with `make_number_changeable()`:**
32
+ ```python
33
+ label = Tex(R"\mu = 0.00")
34
+ decimal = label.make_number_changeable("0.00")
35
+ decimal.add_updater(lambda m: m.set_value(get_mean()))
36
+ ```
37
+
38
+ ### Probability Distributions as Curves
39
+
40
+ **Beta distribution** (`_2020/beta/helpers.py`):
41
+ ```python
42
+ def get_beta_graph(axes, a, b):
43
+ return axes.get_graph(lambda x: scipy.stats.beta.pdf(x, a, b))
44
+ ```
45
+
46
+ **Gaussian** (`_2023/clt/main.py`):
47
+ ```python
48
+ gaussian = axes.get_graph(lambda x: np.exp(-x**2 / 2) / np.sqrt(2 * np.pi))
49
+ gaussian.set_color(YELLOW) # Gaussian is always YELLOW in CLT series
50
+ ```
51
+
52
+ ---
53
+
54
+ ## Topic Planning
55
+
56
+ ### Bayesian Reasoning
57
+
58
+ **Series structure (from `_2019/bayes/` and `_2020/med_test.py`):**
59
+
60
+ 1. **The medical test problem**: 1% disease prevalence, 90% sensitivity, 9% false positive. What's P(disease|positive test)?
61
+ 2. **Population approach**: Show 1000 people, color by disease, then by test result
62
+ 3. **The odds form**: Likelihood ratio as the "update factor"
63
+ 4. **Bayes' rule formula**: Derived from the population visualization
64
+
65
+ **Key visual technique -- population frequency approach:**
66
+ ```
67
+ 1000 people → 10 sick + 990 healthy
68
+ 10 sick → 9 true positive + 1 false negative
69
+ 990 healthy → 89 false positive + 901 true negative
70
+ P(sick|positive) = 9/(9+89) = 9%
71
+ ```
72
+
73
+ **Color conventions for Bayes:**
74
+ - Disease positive: RED
75
+ - Disease negative: GREEN
76
+ - Test positive: highlighted/bright
77
+ - Test negative: muted
78
+ - True positive: RED + bright
79
+ - False positive: GREEN + bright (the surprising case!)
80
+
81
+ ### Central Limit Theorem
82
+
83
+ **Series structure (from `_2023/clt/`):**
84
+
85
+ 1. **Dice sums**: Roll dice, sum them, see distribution shape
86
+ 2. **Mean and standard deviation**: What these statistics measure
87
+ 3. **Building the Gaussian**: Construct the formula piece by piece
88
+ 4. **Why it works**: Convolution + moment generating functions
89
+
90
+ **The convolution visualization is key:**
91
+ ```python
92
+ new_dist = np.convolve(dist1, dist2)
93
+ ```
94
+
95
+ Show two distributions being convolved:
96
+ 1. One distribution fixed, the other slides across
97
+ 2. At each position, multiply corresponding values
98
+ 3. Sum gives the convolution value at that point
99
+ 4. The result distribution approaches Gaussian
100
+
101
+ **Galton Board (`_2023/clt/galton_board.py`):**
102
+ Physical simulation of balls bouncing through pegs. Sound effects (`self.add_sound("clack")`) add tangibility. The balls accumulate into bins that form a bell curve.
103
+
104
+ ### Beta Distribution
105
+
106
+ **Series structure (from `_2020/beta/`):**
107
+
108
+ 1. **beta1.py**: Comparing online sellers (100%/10 reviews vs 96%/50 reviews)
109
+ 2. **beta2.py**: Bayesian updating with weighted coins
110
+ 3. **beta3.py**: Full Bayesian update visualization
111
+
112
+ **Key visual: coin grid with dynamic updating**
113
+ - Grid of coins, some showing heads, some tails
114
+ - As the probability parameter changes, coins flip
115
+ - The posterior distribution updates accordingly
116
+
117
+ **ValueTracker pattern for interactive distributions:**
118
+ ```python
119
+ h_tracker = ValueTracker(0.5)
120
+ graph = always_redraw(lambda: axes.get_graph(
121
+ lambda x: scipy.stats.beta.pdf(x, a, b),
122
+ color=BLUE
123
+ ))
124
+ self.play(h_tracker.animate.set_value(0.8))
125
+ ```
126
+
127
+ ### Conditional Probability / Essentials of Probability
128
+
129
+ **From `_2018/eop/`:**
130
+
131
+ Chapter 0: What does probability even mean? (Frequentist vs Bayesian)
132
+ Chapter 1: Counting, combinations, Pascal's triangle
133
+ Chapter 2: Binomial distribution, random walks
134
+
135
+ **Pascal's triangle** (`_2018/eop/pascal.py`): Visual construction with combination values.
136
+
137
+ **Combinations** (`_2018/eop/combinations.py`): Choosing subsets with visual counting.
138
+
139
+ ---
140
+
141
+ ## Storytelling Patterns for Probability
142
+
143
+ ### The "Most People Get This Wrong" Hook
144
+
145
+ Probability is IDEAL for this opening because human intuition about probability is consistently poor.
146
+
147
+ **Examples:**
148
+ - Medical test: "A test is 90% accurate. You test positive. What's the probability you actually have the disease? Most people say 90%. The real answer shocks them."
149
+ - Monty Hall: "Should you switch doors?"
150
+ - Birthday problem: "How many people do you need for a 50% chance of shared birthday?"
151
+
152
+ ### The Population Approach (3b1b's Preferred Method)
153
+
154
+ Instead of abstract formulas, SHOW a population:
155
+ 1. Draw a large group (grid of dots/people)
156
+ 2. Color subsets by property
157
+ 3. Zoom into the relevant subset
158
+ 4. Count directly
159
+
160
+ This makes conditional probability visual and intuitive.
161
+
162
+ ### The Simulation Approach
163
+
164
+ Run many trials and show the empirical distribution converging to the theoretical one:
165
+ ```python
166
+ # From CLT dice simulation
167
+ for n in range(n_sums):
168
+ if n < 10:
169
+ self.run_one_sum(animated=True)
170
+ else:
171
+ self.run_one_sum(animated=False, still_frame=True)
172
+ ```
173
+
174
+ The speed-up pattern is essential: show the first few trials slowly, then accelerate to show convergence.
175
+
176
+ ---
177
+
178
+ ## Color Conventions for Probability
179
+
180
+ | Element | Color | Context |
181
+ |---------|-------|---------|
182
+ | Favorable outcomes | GREEN | Positive events |
183
+ | Unfavorable outcomes | RED | Negative events |
184
+ | Gaussian curve | YELLOW | CLT series |
185
+ | Prior distribution | BLUE | Bayesian updating |
186
+ | Posterior distribution | YELLOW or GREEN | Bayesian updating |
187
+ | Likelihood | RED or MAROON | Bayesian updating |
188
+ | Dice faces | Distinct per die | CLT dice examples |
189
+ | Probability bars | BLUE-GREEN gradient | Distribution charts |
190
+
191
+ ---
192
+
193
+ ## Common Pitfalls in Probability Videos
194
+
195
+ 1. **Starting with axioms**: Probability axioms are dry. Start with a concrete problem.
196
+ 2. **Formula before intuition**: P(A|B) = P(A and B)/P(B) means nothing without a population grid.
197
+ 3. **Not showing enough trials**: One trial is an anecdote. Show 10, 100, 1000 trials to build the distribution.
198
+ 4. **Treating discrete and continuous the same**: They need different visual approaches. Bars for discrete, smooth curves for continuous.
199
+ 5. **Ignoring the emotional hook**: Probability problems that SURPRISE people ("the answer is only 9%!") are the best hooks.
200
+ 6. **Not calibrating the "intuition pump"**: Before showing the math, ask the viewer what they think the answer is. This primes them to be surprised.