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.

rulesinteractive.md

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

ManimGL Interactive Development

ManimGL's killer feature is interactive development mode, allowing you to iterate rapidly without re-rendering the entire scene.

Starting Interactive Mode

Use the -se (skip and embed) flag with a line number:

# Enter interactive mode at line 20
manimgl scene.py MyScene -se 20

# Enter at the beginning
manimgl scene.py MyScene -se 1

The scene runs up to that line, then drops into an IPython shell.

checkpoint_paste()

The core workflow function. Copy code to your clipboard, then:

# Run code from clipboard with full animations
checkpoint_paste()

# Run instantly without animations (for quick iteration)
checkpoint_paste(skip=True)

# Record animations while running
checkpoint_paste(record=True)

Typical Workflow

  1. Write your scene with placeholder line
  2. Run with -se at that line
  3. Copy animation code to clipboard
  4. Call checkpoint_paste() to test
  5. Iterate until satisfied
  6. Move code into the actual file

self.embed()

Drop into IPython shell programmatically:

class MyScene(InteractiveScene):
    def construct(self):
        circle = Circle()
        self.play(ShowCreation(circle))

        self.embed()  # Pause here, enter shell

        # Code below runs after you exit the shell
        self.play(FadeOut(circle))

In the shell, you have full access to:

  • self - the scene
  • All mobjects in scope
  • All ManimGL functions

Interactive Shell Commands

Once in the shell:

# Inspect current mobjects
self.mobjects

# Add something new
square = Square()
self.play(ShowCreation(square))

# Clear and try again
self.clear()

# Exit shell and continue scene
exit()
# or Ctrl+D

Quick Iteration Pattern

class DevelopScene(InteractiveScene):
    def construct(self):
        # Setup that doesn't change often
        axes = Axes()
        self.add(axes)

        # Breakpoint for development
        self.embed()

        # Code you're iterating on goes here
        # (Or use checkpoint_paste() in the shell)

Recording Mode

When you want to capture what you're doing interactively:

# Start recording
checkpoint_paste(record=True)

# All animations are now recorded
# When done, video is saved

Useful Shell Variables

# Current frame (camera)
self.frame

# All mobjects
self.mobjects

# Specific mobjects by type
[m for m in self.mobjects if isinstance(m, Circle)]

# Frame center
self.frame.get_center()

Debugging Tips

# Print mobject info
print(circle.get_center())
print(circle.get_height())
print(circle.get_color())

# Highlight a mobject
circle.set_color(YELLOW)
self.wait(0.1)

# Check what's in the scene
print(len(self.mobjects))

Exit and Continue

# After interactive session, continue scene
exit()  # or Ctrl+D

# The scene continues from where it left off

Best Practices

  1. Use -se during development - Much faster than re-rendering
  2. Keep setup code before the embed - Reuse state
  3. Use checkpoint_paste(skip=True) - For quick tests
  4. Use checkpoint_paste(record=True) - When you've got it right
  5. Organize code into functions - Easier to paste and test

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