$npx -y skills add AlexAI-MCP/hermes-CCC --skill manim-videoCreate mathematical animations and explainer videos with Manim Community - code-driven animations for math, CS concepts, data visualization.
| 1 | # Manim Video |
| 2 | |
| 3 | ## Purpose |
| 4 | |
| 5 | - Use this skill to create precise, code-driven animations for mathematics, computer science, algorithms, and data visualization. |
| 6 | - Prefer Manim when the content is structural, symbolic, or instructional rather than cinematic live-action editing. |
| 7 | - Manim is especially strong for equations, graphs, geometric constructions, and animated explanations of abstract systems. |
| 8 | |
| 9 | ## Install |
| 10 | |
| 11 | ```bash |
| 12 | pip install manim |
| 13 | ``` |
| 14 | |
| 15 | - On some systems you may also need FFmpeg and LaTeX-related dependencies for full math rendering support. |
| 16 | - Verify the installation with `manim --version`. |
| 17 | |
| 18 | ## Mental Model |
| 19 | |
| 20 | - A Manim scene is a Python class. |
| 21 | - You place visual objects into the scene. |
| 22 | - You animate transitions between states. |
| 23 | - The render command converts the scene into a video file. |
| 24 | - The code is the asset, which makes revisions reproducible. |
| 25 | |
| 26 | ## Minimal Scene Structure |
| 27 | |
| 28 | ```python |
| 29 | from manim import * |
| 30 | |
| 31 | class MyScene(Scene): |
| 32 | def construct(self): |
| 33 | text = Text("Hello, Manim") |
| 34 | self.play(Write(text)) |
| 35 | self.wait() |
| 36 | ``` |
| 37 | |
| 38 | ## Basic Workflow |
| 39 | |
| 40 | 1. Create a Python file such as `scene.py`. |
| 41 | 2. Define one or more scene classes. |
| 42 | 3. Render the desired scene by name. |
| 43 | 4. Inspect the output video. |
| 44 | 5. Revise the code and rerender. |
| 45 | |
| 46 | ## Render Command |
| 47 | |
| 48 | ```bash |
| 49 | manim -pql scene.py MyScene |
| 50 | ``` |
| 51 | |
| 52 | - `-pql` means preview plus quality low. |
| 53 | - Use `-pqh` when you want a higher-quality render for export or sharing. |
| 54 | - Low-quality previews are much faster during iteration. |
| 55 | |
| 56 | ## Core Objects |
| 57 | |
| 58 | - `Circle` |
| 59 | - `Square` |
| 60 | - `Text` |
| 61 | - `MathTex` |
| 62 | - `Axes` |
| 63 | - `NumberPlane` |
| 64 | - `Arrow` |
| 65 | |
| 66 | These cover a large fraction of introductory math and CS explainer work. |
| 67 | |
| 68 | ## Shapes Example |
| 69 | |
| 70 | ```python |
| 71 | from manim import * |
| 72 | |
| 73 | class Shapes(Scene): |
| 74 | def construct(self): |
| 75 | circle = Circle(color=BLUE) |
| 76 | square = Square(color=GREEN).shift(RIGHT * 2) |
| 77 | arrow = Arrow(circle.get_right(), square.get_left(), color=YELLOW) |
| 78 | |
| 79 | self.play(Create(circle), Create(square)) |
| 80 | self.play(Create(arrow)) |
| 81 | self.wait() |
| 82 | ``` |
| 83 | |
| 84 | ## Text and Labels |
| 85 | |
| 86 | - Use `Text` for plain words, labels, titles, and UI-like annotations. |
| 87 | - Use `MathTex` for equations and symbolic math. |
| 88 | - Keep labels short and readable. |
| 89 | - Position text relative to objects with helpers like `.next_to()` and `.to_edge()`. |
| 90 | |
| 91 | ## Math Rendering |
| 92 | |
| 93 | ```python |
| 94 | from manim import * |
| 95 | |
| 96 | class Derivative(Scene): |
| 97 | def construct(self): |
| 98 | expr = MathTex(r"\frac{d}{dx} x^2 = 2x") |
| 99 | self.play(Write(expr)) |
| 100 | self.wait() |
| 101 | ``` |
| 102 | |
| 103 | - Use raw strings for LaTeX-heavy expressions. |
| 104 | - Split long formulas into chunks if you want to animate parts independently. |
| 105 | - `MathTex` is one of Manim's highest-value primitives for educational video. |
| 106 | |
| 107 | ## Graphs |
| 108 | |
| 109 | ```python |
| 110 | from manim import * |
| 111 | |
| 112 | class PlotExample(Scene): |
| 113 | def construct(self): |
| 114 | ax = Axes() |
| 115 | graph = ax.plot(lambda x: x**2, color=BLUE) |
| 116 | label = ax.get_graph_label(graph, label="x^2") |
| 117 | |
| 118 | self.play(Create(ax)) |
| 119 | self.play(Create(graph), FadeIn(label)) |
| 120 | self.wait() |
| 121 | ``` |
| 122 | |
| 123 | - Use `Axes()` for standard 2D coordinate systems. |
| 124 | - Use `NumberPlane()` when you want a visible grid. |
| 125 | - Use `.plot()` for function graphs. |
| 126 | - Add labels only when they clarify the message. |
| 127 | |
| 128 | ## Coordinate Grid Example |
| 129 | |
| 130 | ```python |
| 131 | from manim import * |
| 132 | |
| 133 | class PlaneExample(Scene): |
| 134 | def construct(self): |
| 135 | plane = NumberPlane() |
| 136 | point = Dot(plane.c2p(2, 3), color=RED) |
| 137 | note = Text("Point (2, 3)").scale(0.5).next_to(point, UP) |
| 138 | |
| 139 | self.play(Create(plane)) |
| 140 | self.play(FadeIn(point), Write(note)) |
| 141 | self.wait() |
| 142 | ``` |
| 143 | |
| 144 | ## Common Animations |
| 145 | |
| 146 | - `Create` |
| 147 | - `Write` |
| 148 | - `Transform` |
| 149 | - `FadeIn` |
| 150 | - `FadeOut` |
| 151 | - `MoveAlongPath` |
| 152 | |
| 153 | These are enough to build most educational sequences. |
| 154 | |
| 155 | ## Animation Example |
| 156 | |
| 157 | ```python |
| 158 | from manim import * |
| 159 | |
| 160 | class AnimateBasics(Scene): |
| 161 | def construct(self): |
| 162 | circle = Circle(color=BLUE) |
| 163 | square = Square(color=GREEN) |
| 164 | |
| 165 | self.play(Create(circle)) |
| 166 | self.play(Transform(circle, square)) |
| 167 | self.play(FadeOut(circle)) |
| 168 | ``` |
| 169 | |
| 170 | ## Move Along Path |
| 171 | |
| 172 | ```python |
| 173 | from manim import * |
| 174 | |
| 175 | class AlongPath(Scene): |
| 176 | def construct(self): |
| 177 | path = Circle(radius=2, color=WHITE) |
| 178 | dot = Dot(color=YELLOW).move_to(path.point_from_proportion(0)) |
| 179 | |
| 180 | self.add(path, dot) |
| 181 | self.play(MoveAlongPath(dot, path), run_time=3) |
| 182 | self.wait() |
| 183 | ``` |
| 184 | |
| 185 | - `MoveAlongPath` is useful for state machines, orbital motion, and process flow visuals. |
| 186 | - Use it for conceptual journeys, packets moving through systems, or points moving across graphs. |
| 187 | |
| 188 | ## Layout Helpers |
| 189 | |
| 190 | - `.shift()` |
| 191 | - `.move_to()` |
| 192 | - `.next_to()` |
| 193 | - `.align_ |