All skills
adithya-s-k avatar

/manimce-best-practices

@6668663
by Adithya S Kadithya-s-k/manim_skill1.1k stars
94

Trigger when: (1) User mentions "manim" or "Manim Community" or "ManimCE", (2) Code contains `from manim import *`, (3) User runs `manim` CLI commands, (4) Working with Scene, MathTex, Create(), or ManimCE-specific classes. Best practices for Manim Community Edition - the community-maintained Python animation engine. Covers Scene structure, animations, LaTeX/MathTex, 3D with ThreeDScene, camera control, styling, and CLI usage. NOT for ManimGL/3b1b version (which uses `manimlib` imports and `manimgl` CLI).

Use this Skill: https://skilld.dev/gh/adithya-s-k/manim_skill/manimce-best-practices

This session only. Nothing lands on disk.

ruleslines.md

≈1.2k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Lines and Arrows

Connect points and show relationships with lines and arrows.

Line

Basic line between two points.

from manim import *

class LineExample(Scene):
    def construct(self):
        # Line from two points
        line = Line(LEFT * 2, RIGHT * 2)

        # With styling
        styled_line = Line(
            UP * 2, DOWN * 2,
            color=BLUE,
            stroke_width=4
        )

        self.add(line, styled_line)

Line Properties

line = Line(LEFT, RIGHT)

# Get points
line.get_start()
line.get_end()
line.get_center()
line.get_length()
line.get_angle()

# Modify
line.put_start_and_end_on(new_start, new_end)
line.set_length(3)  # Keep direction, change length

Arrow

Line with an arrowhead.

class ArrowExample(Scene):
    def construct(self):
        # Basic arrow
        arrow = Arrow(LEFT * 2, RIGHT * 2)

        # Styled arrow
        styled = Arrow(
            start=UP,
            end=DOWN,
            color=RED,
            stroke_width=6,
            tip_length=0.4,
            max_tip_length_to_length_ratio=0.5
        )

        self.add(arrow, styled)

Arrow Variations

# Double-headed arrow
double = DoubleArrow(LEFT * 2, RIGHT * 2)

# Arrow with custom tip
arrow = Arrow(LEFT, RIGHT)
arrow.tip  # Access the tip mobject

Vector

Arrow starting from origin (useful for physics/math).

class VectorExample(Scene):
    def construct(self):
        # Vector from origin
        v1 = Vector([2, 1, 0], color=YELLOW)
        v2 = Vector([-1, 2, 0], color=GREEN)

        self.add(v1, v2)

DashedLine

class DashedLineExample(Scene):
    def construct(self):
        dashed = DashedLine(
            LEFT * 2, RIGHT * 2,
            dash_length=0.2,
            dashed_ratio=0.5,  # Ratio of dash to gap
            color=WHITE
        )
        self.add(dashed)

TangentLine

Line tangent to a curve at a point.

class TangentLineExample(Scene):
    def construct(self):
        circle = Circle(radius=2)

        # Tangent at specific point (t parameter 0-1 along curve)
        tangent = TangentLine(circle, alpha=0.25, length=3, color=YELLOW)

        self.add(circle, tangent)

Brace

Curly brace for highlighting.

class BraceExample(Scene):
    def construct(self):
        rect = Rectangle(width=4, height=1)

        # Brace under the rectangle
        brace = Brace(rect, DOWN)

        # With label
        brace_text = brace.get_text("Width")

        # Alternative: BraceLabel
        brace_label = BraceLabel(rect, "Width", DOWN)

        self.add(rect, brace, brace_text)

Brace Directions

brace_down = Brace(mobject, DOWN)
brace_up = Brace(mobject, UP)
brace_left = Brace(mobject, LEFT)
brace_right = Brace(mobject, RIGHT)

CurvedArrow

Curved arrow between points.

class CurvedArrowExample(Scene):
    def construct(self):
        curved = CurvedArrow(
            start_point=LEFT * 2,
            end_point=RIGHT * 2,
            angle=PI/2  # Curvature
        )
        self.add(curved)

Elbow

Right-angle connector.

class ElbowExample(Scene):
    def construct(self):
        elbow = Elbow(width=2, angle=PI/2)
        self.add(elbow)

NumberLine Ticks

class TicksExample(Scene):
    def construct(self):
        line = NumberLine(x_range=[-3, 3, 1])
        self.add(line)

Connecting Mobjects

Line Between Mobjects

class ConnectMobjects(Scene):
    def construct(self):
        c1 = Circle().shift(LEFT * 2)
        c2 = Circle().shift(RIGHT * 2)

        # Line connecting centers
        line = Line(c1.get_center(), c2.get_center())

        # Arrow between edges
        arrow = Arrow(
            c1.get_right(),  # Right edge of c1
            c2.get_left(),   # Left edge of c2
            buff=0.1         # Small gap from edges
        )

        self.add(c1, c2, line, arrow)

Dynamic Connections with Updaters

class DynamicLine(Scene):
    def construct(self):
        dot1 = Dot(LEFT * 2)
        dot2 = Dot(RIGHT * 2)

        # Line that follows dots
        line = always_redraw(lambda: Line(
            dot1.get_center(),
            dot2.get_center(),
            color=YELLOW
        ))

        self.add(dot1, dot2, line)
        self.play(dot1.animate.shift(UP * 2), run_time=2)

Best Practices

  1. Use Arrow for direction - Clearer than plain lines
  2. Use Vector for physics/math - Semantically meaningful
  3. Use Brace for labeling dimensions - Professional look
  4. Use DashedLine for auxiliary lines - Distinguishes from main content
  5. Use always_redraw for dynamic lines - Updates with moving endpoints

Source: SKILL.md on GitHub

No alerts17d5 checks · Risk SAFE
  • Gen Agent Trust Hub17d

    This skill is a comprehensive educational resource for the Manim Community Edition library. It provides best practices, templates, and example scripts for creating mathematical animations and visualizations. No security risks or malicious patterns were identified.

  • Socket17d

    No alerts

  • Snyk17d

    Risk: LOW · No issues

  • Runlayer7mo

    37 files scanned · No issues

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 6668663. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 months ago.

Dormantupdated 8 months ago
  • Python
  • manim
  • animation
  • latex
  • mathtex
  • 3d
  • rendering
  • scene
  • visualization

README badge

README badge for adithya-s-k/manim_skill/manimce-best-practices

Provides best practices and patterns for Manim Community Edition, the Python animation library for mathematical visualizations. Covers Scene structure, animations, LaTeX rendering, 3D graphics, positioning, and CLI usage with organized rule files, working examples, and templates.

Generated from the current SKILL.md.

Does this skill cover ManimGL or just Manim Community Edition?
Only Manim Community Edition (ManimCE). It does not apply to ManimGL/3b1b version, which uses `manimlib` imports and the `manimgl` CLI instead.
What topics are included in this skill?
Scene structure, mobjects, animations (creation, transformation, groups), text and LaTeX rendering, styling, positioning, 3D visualization, timing and updaters, camera control, CLI usage, and common geometric shapes.
Does this skill include working examples?
Yes. It includes five complete example files demonstrating basic animations, math visualization, updater patterns, graph plotting, and 3D visualization, plus three scene templates for 2D, camera-controlled, and 3D scenes.
What should I do if text rendering fails in my Manim scripts?
Check your manimpango installation requirements, as text rendering failures often stem from manimpango configuration issues. The skill also recommends running `manim checkhealth` to verify your overall installation.
How do I render a scene with different quality levels?
Use quality flags with the manim CLI: `-ql` for low quality (fast, development), `-qm` for medium, `-qh` for high, and `-qk` for 4K. For example: `manim -pqh scene.py MyScene`.

Generated from the current SKILL.md. These answers refresh after source changes.