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.

referencesthree_d_surfaces.md

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

3D Surfaces - Reference Guide

Example file: examples/three_d_surfaces.py

User Query Scenarios

This example addresses queries like:

  • "Create a 3D surface visualization"
  • "Show a parametric surface"
  • "Animate camera rotation around object"
  • "Create a torus/sphere/cone"
  • "Show saddle surface"

Scene Thinking Process (3b1b Style)

1. Core Concept

Parametric Surfaces: Define surfaces as functions (u,v) → (x,y,z). Camera movement reveals 3D structure.

2. Technical Implementation

Basic Parametric Surface
surface = ParametricSurface(
    lambda u, v: [u, v, np.sin(u) * np.cos(v)],
    u_range=(-3, 3),
    v_range=(-3, 3),
    resolution=(30, 30),
)
surface.set_color(BLUE)
surface.set_opacity(0.8)
Camera Setup and Movement
frame = self.frame
frame.reorient(-30, 70, 0)  # phi, theta, gamma
frame.set_height(10)

# Animate camera
self.play(frame.animate.reorient(30, 60, 0), run_time=3)
Sphere with Latitude/Longitude Lines
# Latitude lines
for phi in np.linspace(-PI/2 + 0.3, PI/2 - 0.3, 6):
    line = ParametricCurve(
        lambda t: radius * np.array([
            np.cos(t) * np.cos(phi),
            np.sin(t) * np.cos(phi),
            np.sin(phi)
        ]),
        t_range=(0, TAU),
    )
Torus Parameterization
R, r = 2, 0.7  # Major and minor radius
torus = ParametricSurface(
    lambda u, v: [
        (R + r * np.cos(v)) * np.cos(u),
        (R + r * np.cos(v)) * np.sin(u),
        r * np.sin(v)
    ],
    u_range=(0, TAU),
    v_range=(0, TAU),
)

3. Scene Variants

Scene Purpose
ParametricSurface3D z = sin(x)cos(y) with camera orbit
SphereSurface Sphere with grid lines, rotating
ConeUnfolding 3D cone visualization
SaddleSurface z = x² - y² with cross-sections
TorusSurface Donut shape with rotation

Key Patterns

Pattern: ThreeDAxes

axes = ThreeDAxes(
    x_range=(-3, 3, 1),
    y_range=(-3, 3, 1),
    z_range=(-2, 2, 1),
)

Pattern: Rotating Objects

self.play(
    Rotate(surface, TAU, axis=UP, run_time=6, rate_func=linear),
)

Pattern: Frame Reorientation

# reorient(phi, theta, gamma, center, height)
frame.reorient(-30, 70, 0)  # Just angles
frame.animate.reorient(60, 60, 0)  # Animated

Run Commands

manimgl three_d_surfaces.py ParametricSurface3D -w
manimgl three_d_surfaces.py SphereSurface -w
manimgl three_d_surfaces.py TorusSurface -w
manimgl three_d_surfaces.py SaddleSurface -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