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.

referencesrotating_exponentials.md

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

Rotating Exponentials - Reference Guide

Example file: examples/rotating_exponentials.py

User Query Scenarios

This example addresses queries like:

  • "Visualize e^(it) on the complex plane"
  • "Show Euler's formula animation"
  • "Demonstrate how cosine comes from rotating exponentials"
  • "Create a complex plane with rotating vector"
  • "Show e^(iπ) = -1 visually"

Scene Thinking Process (3b1b Style)

1. Core Concept

Euler's Formula: e^(it) = cos(t) + i·sin(t) - a rotating unit vector in the complex plane. Two counter-rotating exponentials sum to give real cosine.

2. Visual Design Decisions

Why use ComplexPlane?

  • Natural coordinate system for complex numbers
  • Built-in grid and labels
  • n2p() method converts complex to point

Why show the traced path?

  • Reveals the unit circle emerges naturally
  • Shows the relationship between angle and position

3. Technical Implementation

Rotating Vector with TracedPath
time_tracker = ValueTracker(0)

vector = Vector(RIGHT, color=YELLOW)
vector.add_updater(lambda v: v.put_start_and_end_on(
    ORIGIN,
    plane.n2p(np.exp(1j * time_tracker.get_value()))
))

tip_dot = Dot(color=YELLOW)
tip_dot.add_updater(lambda d: d.move_to(vector.get_end()))

traced = TracedPath(tip_dot.get_center, stroke_color=BLUE)
Counter-Rotating for Cosine
# e^(it) rotates counter-clockwise
v1.add_updater(lambda v: v.put_start_and_end_on(
    ORIGIN, plane.n2p(np.exp(1j * t))
))
# e^(-it) rotates clockwise
v2.add_updater(lambda v: v.put_start_and_end_on(
    ORIGIN, plane.n2p(np.exp(-1j * t))
))
# Sum is always real: 2cos(t)

4. Scene Variants

Scene Purpose
RotatingExponential Basic e^(it) visualization
CounterRotatingExponentials Shows e^(it) + e^(-it) = 2cos(t)
EulersFormula Famous e^(iπ) = -1
ComplexExponentialSpiral Decaying spiral e^((a+bi)t)

Key Patterns

Pattern: always_redraw for Arcs

angle_arc = always_redraw(lambda: Arc(
    start_angle=0,
    angle=time_tracker.get_value() % TAU,
    radius=0.3,
    color=GREEN
))

Pattern: Complex Number to Point

# Using ComplexPlane.n2p() (number to point)
point = plane.n2p(1 + 2j)  # Complex number
point = plane.n2p(np.exp(1j * theta))  # Euler form

Run Commands

manimgl rotating_exponentials.py RotatingExponential -w
manimgl rotating_exponentials.py CounterRotatingExponentials -w
manimgl rotating_exponentials.py EulersFormula -w
manimgl rotating_exponentials.py ComplexExponentialSpiral -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