# Manimgl Best Practices > Buenas prácticas de ManimGL (la versión de Grant Sanderson): InteractiveScene, Tex con t2c, control de cámara, modo interactivo con -se, renderizado 3D y flujo de checkpoint_paste(). Fuente: https://skillsagentes.com/skills/calesthio/openmontage/manimgl-best-practices Markdown: https://skillsagentes.com/skills/calesthio/openmontage/manimgl-best-practices.md Repositorio: https://github.com/calesthio/OpenMontage Autor: calesthio Licencia: AGPL-3.0 Actualizado: el mes pasado Coste de contexto: 152 tok instalada, 1.9k tok al activarse, 186.5k tok con todos los archivos del bundle Bundle: 107 archivos, 729 KB Permisos que pide: ninguno declarado ## Instalación Un skill son archivos markdown: los mismos archivos valen para cualquier agente y lo único que cambia es el directorio de destino, es decir la bandera `--agent`. Añade `-g` para instalarlo en todos los proyectos de la máquina. ```bash # Claude Code npx -y skills add calesthio/OpenMontage --skill manimgl-best-practices --agent claude-code # Cursor npx -y skills add calesthio/OpenMontage --skill manimgl-best-practices --agent cursor # Codex npx -y skills add calesthio/OpenMontage --skill manimgl-best-practices --agent codex # Gemini CLI npx -y skills add calesthio/OpenMontage --skill manimgl-best-practices --agent gemini # Windsurf npx -y skills add calesthio/OpenMontage --skill manimgl-best-practices --agent windsurf # Cline npx -y skills add calesthio/OpenMontage --skill manimgl-best-practices --agent cline ``` ## Qué hace - Reúne buenas prácticas de ManimGL, la versión de 3Blue1Brown basada en OpenGL con desarrollo interactivo - Cubre `InteractiveScene`, `Tex` con `t2c` y control de la cámara mediante `self.frame` - Documenta el modo interactivo con la bandera `-se` y el flujo de `checkpoint_paste()` - Explica renderizado 3D, plano de suelo y `backstroke` para legibilidad del texto - Recoge patrones habituales, incluido `self.embed()` para depurar ## Cuándo usarla - El usuario menciona "manimgl", "ManimGL" o "3b1b manim" - El código contiene `from manimlib import *` - Se ejecutan comandos `manimgl` del CLI - Se trabaja con `InteractiveScene`, `self.frame`, `self.embed()` o `ShowCreation()` ## Cuándo no - Manim Community Edition, que usa imports de `manim` y el CLI `manim` ## Qué la activa - "Anima esto con ManimGL" - "¿Cómo muevo la cámara en 3D con self.frame?" - "Entra en modo interactivo en esta línea" - "Colorea partes de esta fórmula con t2c" ## Antes de instalar - Necesita ManimGL instalado; usa cadenas raw con `R` para LaTeX en la clase `Tex`. - Necesita en el PATH: pip ## Archivos - LICENSE.txt — 1 KB - SKILL.md — 7 KB - examples/attention_arcs_animation.py — 8 KB - examples/attention_pattern_dots.py — 4 KB - examples/attention_scenes.py — 34 KB - examples/attention_softmax_masking.py — 4 KB - examples/autoregressive_flow.py — 7 KB - examples/basic_multihead.py — 5 KB - examples/bloch_sphere_3d.py — 7 KB - examples/block_collision_basic.py — 5 KB - examples/blocks_3d.py — 7 KB - examples/collision_phase_space.py — 10 KB - examples/complex_s_plane.py — 10 KB - examples/cost_function.py — 4 KB - examples/cube_projection_3d.py — 6 KB - examples/damped_solutions_splane.py — 9 KB - examples/dot_product_visualization.py — 5 KB - examples/double_slit_interference.py — 11 KB - examples/eigenvalue_equations.py — 7 KB - examples/eigenvector_flow_field.py — 7 KB - examples/eigenvector_matrix_transformation.py — 6 KB - examples/elastic_collision_vectors.py — 10 KB - examples/embedding_matrix.py — 6 KB - examples/equation_transforms.py — 10 KB - examples/exponential_derivative.py — 8 KB - examples/fibonacci_eigenvalues.py — 6 KB - examples/gradient_descent_basic.py — 7 KB - examples/hexagon_cube_correspondence.py — 3 KB - examples/integration_visualization.py — 7 KB - examples/laplace_integral.py — 9 KB - examples/light_polarization.py — 11 KB - examples/linear_regression.py — 4 KB - examples/llm_prediction_pipeline.py — 9 KB - examples/lorenz_attractor.py — 5 KB - examples/lozenge_tiling.py — 3 KB - examples/max_random_process.py — 6 KB - examples/mlp_forward_pass.py — 9 KB - examples/mlp_network_icon.py — 3 KB - examples/mlp_neuron_activation.py — 8 KB - examples/mlp_neurons_flow.py — 10 KB - examples/mlp_relu_visualization.py — 5 KB - examples/mlp_vector_space.py — 9 KB - examples/mlp_weight_matrix.py — 8 KB - examples/multi_head_attention.py — 8 KB - examples/network_block_flow.py — 8 KB - examples/neural_network_basic.py — 4 KB - examples/parallax_starfield.py — 6 KB - examples/probability_distribution.py — 12 KB - examples/probability_output.py — 12 KB - examples/quantum_gates.py — 9 KB - examples/qubit_state_vector.py — 6 KB - examples/query_key_dot_products.py — 4 KB - examples/query_key_space_mapping.py — 6 KB - examples/radial_wave_visualization.py — 8 KB - examples/rotating_exponentials.py — 9 KB - examples/semantic_similarity.py — 6 KB - examples/simple_test.py — 2 KB - examples/softmax_visualization.py — 5 KB - examples/solve_damped_ode.py — 9 KB - examples/spring_mass_system.py — 10 KB - examples/sqrt_random_process.py — 5 KB - examples/superposition_effect.py — 9 KB - examples/three_d_surfaces.py — 6 KB - examples/three_d_vector_space.py — 3 KB - examples/token_embeddings_flow.py — 6 KB - examples/token_probability_distribution.py — 6 KB - examples/token_sampling.py — 6 KB - examples/token_to_embedding.py — 8 KB - examples/tokenization_demo.py — 6 KB - examples/transit_animation.py — 6 KB - examples/value_matrix_transform.py — 7 KB - examples/vector_fields.py — 7 KB - examples/wave_amplitude_visualization.py — 13 KB - examples/weight_matrix_product.py — 6 KB - examples/weights_vs_data.py — 6 KB - examples/word_vector_analogy.py — 6 KB - examples/zone_plate_hologram.py — 11 KB - references/equation_transforms.md — 2 KB - references/integration_visualization.md — 2 KB - references/parallax_starfield.md — 4 KB - references/rotating_exponentials.md — 3 KB - references/spring_mass_system.md — 3 KB - references/three_d_surfaces.md — 3 KB - references/transit_animation.md — 2 KB - references/vector_fields.md — 3 KB - rules/3d.md — 8 KB - rules/animation-groups.md — 10 KB - rules/animations.md — 4 KB - rules/camera.md — 10 KB - rules/cli.md — 8 KB - rules/colors.md — 8 KB - rules/config.md — 8 KB - rules/creation-animations.md — 8 KB - rules/embedding.md — 10 KB - rules/frame.md — 3 KB - rules/interactive.md — 3 KB - rules/mobjects.md — 4 KB - rules/scenes.md — 2 KB - rules/styling.md — 9 KB - rules/t2c.md — 6 KB - rules/tex.md — 3 KB - rules/text.md — 5 KB - rules/transform-animations.md — 10 KB - templates/3d_scene.py — 7 KB - templates/basic_scene.py — 3 KB - templates/interactive_scene.py — 2 KB - templates/math_scene.py — 8 KB ## SKILL.md Reproducido tal cual desde calesthio/OpenMontage bajo AGPL-3.0. Esta sección es el documento original y está en inglés. ## How to use Read individual rule files for detailed explanations and code examples: ### Core Concepts - [rules/scenes.md](rules/scenes.md) - InteractiveScene, Scene types, and construct method - [rules/mobjects.md](rules/mobjects.md) - Mobject types, VMobject, Groups, and positioning - [rules/animations.md](rules/animations.md) - Animation classes, playing animations, and timing ### Creation & Transformation - [rules/creation-animations.md](rules/creation-animations.md) - ShowCreation, Write, FadeIn, DrawBorderThenFill - [rules/transform-animations.md](rules/transform-animations.md) - Transform, ReplacementTransform, TransformMatchingTex - [rules/animation-groups.md](rules/animation-groups.md) - LaggedStart, Succession, AnimationGroup ### Text & Math - [rules/tex.md](rules/tex.md) - Tex class, raw strings R"...", and LaTeX rendering - [rules/text.md](rules/text.md) - Text mobjects, fonts, and styling - [rules/t2c.md](rules/t2c.md) - tex_to_color_map (t2c) for coloring math expressions ### Styling & Appearance - [rules/colors.md](rules/colors.md) - Color constants, gradients, RGB, hex, GLSL coloring - [rules/styling.md](rules/styling.md) - Fill, stroke, opacity, backstroke, gloss, shadow ### 3D & Camera - [rules/3d.md](rules/3d.md) - 3D objects, surfaces, Sphere, Torus, parametric surfaces, lighting - [rules/camera.md](rules/camera.md) - frame.reorient(), Euler angles, fix_in_frame(), camera animations ### Interactive Development - [rules/interactive.md](rules/interactive.md) - Interactive mode with `-se` flag, checkpoint_paste() - [rules/frame.md](rules/frame.md) - self.frame, camera control, reorient, and zooming - [rules/embedding.md](rules/embedding.md) - self.embed() for IPython debugging, touch() mode ### Configuration & CLI - [rules/cli.md](rules/cli.md) - manimgl command, flags (-w, -o, -se, -l, -h), rendering options - [rules/config.md](rules/config.md) - custom_config.yml, directories, camera settings, quality presets ## Working Examples Complete, tested example files demonstrating common patterns: - [examples/basic_animations.py](examples/basic_animations.py) - Basic shapes, text, and animations - [examples/math_visualization.py](examples/math_visualization.py) - LaTeX equations and mathematical content - [examples/graph_plotting.py](examples/graph_plotting.py) - Axes, functions, and graphing - [examples/3d_visualization.py](examples/3d_visualization.py) - 3D scenes with camera control and surfaces - [examples/updater_patterns.py](examples/updater_patterns.py) - Dynamic animations with updaters ## Scene Templates Copy and modify these templates to start new projects: - [templates/basic_scene.py](templates/basic_scene.py) - Standard 2D scene template - [templates/interactive_scene.py](templates/interactive_scene.py) - InteractiveScene with self.embed() - [templates/3d_scene.py](templates/3d_scene.py) - 3D scene with frame.reorient() - [templates/math_scene.py](templates/math_scene.py) - Mathematical derivations and equations ## Quick Reference ### Basic Scene Structure ```python from manimlib import * class MyScene(InteractiveScene): def construct(self): # Create mobjects circle = Circle() # Add to scene (static) self.add(circle) # Or animate self.play(ShowCreation(circle)) # Note: ShowCreation, not Create # Wait self.wait(1) ``` ### Render Command ```bash # Render and preview manimgl scene.py MyScene # Interactive mode - drop into shell at line 15 manimgl scene.py MyScene -se 15 # Write to file manimgl scene.py MyScene -w # Low quality for testing manimgl scene.py MyScene -l ``` ### Key Differences from ManimCE | Feature | ManimGL (3b1b) | Manim Community | |---------|----------------|-----------------| | Import | `from manimlib import *` | `from manim import *` | | CLI | `manimgl` | `manim` | | Math text | `Tex(R"\pi")` | `MathTex(r"\pi")` | | Scene | `InteractiveScene` | `Scene` | | Create anim | `ShowCreation` | `Create` | | Camera | `self.frame` | `self.camera.frame` | | Fix in frame | `mob.fix_in_frame()` | `self.add_fixed_in_frame_mobjects(mob)` | | Package | `manimgl` (PyPI) | `manim` (PyPI) | ### Interactive Development Workflow ManimGL's killer feature is interactive development: ```bash # Start at line 20 with state preserved manimgl scene.py MyScene -se 20 ``` In interactive mode: ```python # Copy code to clipboard, then run: checkpoint_paste() # Run with animations checkpoint_paste(skip=True) # Run instantly (no animations) checkpoint_paste(record=True) # Record while running ``` ### Camera Control (self.frame) ```python # Get the camera frame frame = self.frame # Reorient in 3D (phi, theta, gamma, center, height) frame.reorient(45, -30, 0, ORIGIN, 8) # Animate camera movement self.play(frame.animate.reorient(60, -45, 0)) # Fix mobjects to stay in screen space during 3D movement title.fix_in_frame() ``` ### LaTeX with Tex class ```python # Use raw strings with capital R formula = Tex(R"\int_0^1 x^2 \, dx = \frac{1}{3}") # Color mapping with t2c equation = Tex( R"E = mc^2", t2c={"E": BLUE, "m": GREEN, "c": YELLOW} ) # Isolate substrings for animation formula = Tex(R"\sum_{n=1}^{\infty} \frac{1}{n^2} = \frac{\pi^2}{6}") formula.set_color_by_tex("n", BLUE) ``` ### Common Patterns #### Embedding for debugging ```python def construct(self): circle = Circle() self.play(ShowCreation(circle)) self.embed() # Drops into IPython shell here ``` #### Set floor plane for 3D ```python self.set_floor_plane("xz") # Makes xy the viewing plane ``` #### Backstroke for text readability ```python text = Text("Label") text.set_backstroke(BLACK, 5) # Black outline behind text ``` ### Installation ```bash # Install ManimGL pip install manimgl # Check installation manimgl --version ``` ### Common Pitfalls to Avoid 1. **Version confusion** - Ensure you're using `manimgl`, not `manim` (community version) 2. **ShowCreation vs Create** - ManimGL uses `ShowCreation`, not `Create` 3. **Tex vs MathTex** - ManimGL uses `Tex` with capital R raw strings 4. **self.frame vs self.camera.frame** - ManimGL uses `self.frame` directly 5. **fix_in_frame()** - Call on the mobject, not the scene 6. **Interactive mode** - Use `-se` flag for interactive development ## License & Attribution This skill contains example code adapted from [3Blue1Brown's video repository](https://github.com/3b1b/videos) by Grant Sanderson. **License:** [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/) - **Attribution required** - Credit both 3Blue1Brown and the adapter - **NonCommercial** - Not for commercial use - **ShareAlike** - Derivatives must use the same license See [LICENSE.txt](LICENSE.txt) for full details. ## Dónde encaja - Categoría: [Aprendizaje](https://skillsagentes.com/categorias/aprendizaje.md) — Explicaciones, tutorías y flujos de estudio estructurado. - Creador: [calesthio](https://skillsagentes.com/creators/calesthio.md) — 0 skills en el directorio - [Todas las skills](https://skillsagentes.com/skills.md) - [Ranking de instalaciones](https://skillsagentes.com/ranking.md) ## Otras skills del mismo repositorio - [Seedance 2 5](https://skillsagentes.com/skills/calesthio/openmontage/seedance-2-5.md): Genera vídeo cinematográfico de 4-30 s con ByteDance Seedance 2.5 por fal.ai, Volcengine Ark, Runway o ComfyUI. Cubre el contrato de prompt 2.5, cortes duros, locks de continuidad y voz. - [Comfyui](https://skillsagentes.com/skills/calesthio/openmontage/comfyui.md): Úsalo al trabajar con workflows de ComfyUI en OpenMontage: comfyui_image/video/music, workflows propios, selección de output_node, modelos que faltan, LoRAs, poca VRAM e importación de workflows de la comunidad. - [Fish Audio Tts](https://skillsagentes.com/skills/calesthio/openmontage/fish-audio-tts.md): Genera narración expresiva y multilingüe con fish.audio (modelos S1 / S2) y reutiliza voces clonadas mediante reference_id. - [Minimax H3](https://skillsagentes.com/skills/calesthio/openmontage/minimax-h3.md): Genera vídeo con MiniMax H3 (Hailuo 3.0) por la API oficial v2, fal.ai, Runway, nodos partner de ComfyUI o pesos abiertos locales. Clips de 4-15s a 2K con animación de primer/último fotograma. - [Gemini Omni](https://skillsagentes.com/skills/calesthio/openmontage/gemini-omni.md): Genera y edita conversacionalmente vídeos cortos con Google Gemini Omni Flash: itera con ediciones en lenguaje natural, clips de 3-10s a 720p con audio y texto en pantalla, e imágenes de referencia por etiquetas. --- Skills Agentes · [Índice de páginas en markdown](https://skillsagentes.com/sitemap.md) · [Inicio](https://skillsagentes.com/index.md)