All skills
adithya-s-k avatar

/manimgl-best-practices

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

Trigger when: (1) User mentions "manimgl" or "ManimGL" or "3b1b manim", (2) Code contains `from manimlib import *`, (3) User runs `manimgl` CLI commands, (4) Working with InteractiveScene, self.frame, self.embed(), ShowCreation(), or ManimGL-specific patterns. Best practices for ManimGL (Grant Sanderson's 3Blue1Brown version) - OpenGL-based animation engine with interactive development. Covers InteractiveScene, Tex with t2c, camera frame control, interactive mode (-se flag), 3D rendering, and checkpoint_paste() workflow. NOT for Manim Community Edition (which uses `manim` imports and `manim` CLI).

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

This session only. Nothing lands on disk.

referencesequation_transforms.md

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

Equation Transforms - Reference Guide

Example file: examples/equation_transforms.py

User Query Scenarios

This example addresses queries like:

  • "Show step-by-step equation derivation"
  • "Animate the quadratic formula derivation"
  • "Highlight parts of an equation"
  • "Show variable substitution with color tracking"
  • "Add braces to explain equation parts"

Scene Thinking Process (3b1b Style)

1. Core Concept

Mathematical Derivations: Step-by-step equation manipulation is clearer when terms are color-coded and transformations are animated smoothly.

2. Technical Implementation

Color-Coded Terms with t2c
eq = Tex(
    r"ax^2 + bx + c = 0",
    t2c={"a": RED, "b": GREEN, "c": BLUE, "x": YELLOW}
)
Smooth Equation Transformation
eq1 = Tex(r"ax^2 + bx + c = 0", t2c=colors)
eq2 = Tex(r"x^2 + \frac{b}{a}x + \frac{c}{a} = 0", t2c=colors)
self.play(TransformMatchingTex(eq1.copy(), eq2))

Key insight: TransformMatchingTex matches characters between equations and morphs them smoothly.

Highlighting with SurroundingRectangle
part = eq[r"a^2"]  # Select by tex string
rect = SurroundingRectangle(part, color=RED, buff=0.05)
self.play(ShowCreation(rect))
Brace Annotations
brace = Brace(eq["F"], UP, color=BLUE)
label = brace.get_text("Force", font_size=30)
self.play(GrowFromCenter(brace), FadeIn(label, UP))

3. Scene Variants

Scene Purpose
QuadraticFormula Full derivation with step labels
HighlightAndTransform Highlighting + visual proof
BraceAnnotations F=ma with labeled parts
ColorCodedSubstitution u-substitution with tracking

Key Patterns

Pattern: Step Labels

step_label = Text("Divide by a", font_size=24, color=GREY)
step_label.next_to(eq2, LEFT, buff=0.5)
self.play(FadeIn(step_label, LEFT))

Pattern: Final Answer Box

final = Tex(r"x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}")
box = SurroundingRectangle(final, color=GOLD, buff=0.2)
self.play(ShowCreation(box))

Pattern: Selecting Equation Parts

# By tex substring
eq["x^2"]  # Returns submobject matching "x^2"
eq[r"\frac{b}{a}"]  # LaTeX commands work too

# By index
eq[0]  # First character/group

Run Commands

manimgl equation_transforms.py QuadraticFormula -w
manimgl equation_transforms.py HighlightAndTransform -w
manimgl equation_transforms.py BraceAnnotations -w
manimgl equation_transforms.py ColorCodedSubstitution -w

Source: SKILL.md on GitHub

No alerts17d5 checks · Risk SAFE
  • Gen Agent Trust Hub17d

    The skill is an educational resource for the ManimGL mathematical animation library, providing best practices and functional examples. All code patterns, including CLI boilerplate and external asset references, are standard and safe for the intended use cases.

  • Socket17d

    No alerts

  • Snyk17d

    Risk: LOW · No issues

  • Runlayer7mo

    1/107 files flagged

  • ZeroLeaks5mo

    1 finding · Score: 86/100

Signed by skilld at 2375ac0. 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

README badge

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