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.

rulesscenes.md

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

ManimGL Scenes

Scene Types

ManimGL provides several scene types:

InteractiveScene (Recommended)

The default for most development. Supports interactive mode with -se flag.

from manimlib import *

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

Scene (Base Class)

Basic scene without interactive features:

class BasicScene(Scene):
    def construct(self):
        self.play(Write(Text("Hello")))

ThreeDScene

For 3D animations with proper camera setup:

from manimlib import *

class My3DScene(ThreeDScene):
    def construct(self):
        axes = ThreeDAxes()
        self.add(axes)
        self.camera.frame.reorient(-45*DEGREES, 75*DEGREES)

The construct Method

All scene logic goes in construct():

class MyScene(InteractiveScene):
    def construct(self):
        # 1. Create mobjects
        circle = Circle(color=BLUE)
        square = Square(color=RED)

        # 2. Position them
        circle.shift(LEFT * 2)
        square.shift(RIGHT * 2)

        # 3. Animate
        self.play(ShowCreation(circle), ShowCreation(square))

        # 4. Wait for viewer
        self.wait(2)

Adding vs Playing

# Static add (instant, no animation)
self.add(circle)

# Animated add
self.play(ShowCreation(circle))
self.play(FadeIn(square))

Scene Methods

Method Description
self.play(*anims) Play animations
self.wait(t) Wait t seconds
self.add(*mobs) Add mobjects instantly
self.remove(*mobs) Remove mobjects
self.clear() Clear all mobjects
self.embed() Drop into IPython shell

Interactive Mode

Run with -se flag to enter at a specific line:

manimgl scene.py MyScene -se 15

In the shell:

checkpoint_paste()           # Run clipboard code with animations
checkpoint_paste(skip=True)  # Run instantly
checkpoint_paste(record=True) # Record while running

Class Attributes

Define scene configuration as class attributes:

class MyScene(InteractiveScene):
    camera_class = ThreeDCamera  # Use 3D camera
    random_seed = 42             # For reproducibility

    def construct(self):
        ...

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