Writing Prompts for AI Math Animations | QuantumSketch

Write prompts for AI math animations by naming the concept, the visual metaphor, the beats, and the audience. Templates and examples inside.

By Shihab
2 min read

Write a prompt for an AI math animation by naming four things: the concept, a visual metaphor, the sequence of beats, and the audience. That structure gives the model enough to write correct Manim code and a matching narration.

The four-part formula

[Concept] + [visual metaphor] + [beats] + [audience]

Weak prompt:

"Explain the derivative."

Strong prompt:

"Show the derivative as the slope of a secant line that becomes a tangent as h → 0, on the curve f(x) = x². Three beats: draw the secant, shrink h, snap to the tangent. For a high-school calculus student."

The strong version tells the LLM what to draw (Axes, ParametricFunction, a secant Line), how it moves (Transform), and how the narration should sound.

Prompt templates you can copy

| Goal | Template | |---|---| | Concept intro | "Introduce X using [metaphor], in 4 beats, for [level]." | | Step-by-step proof | "Prove X visually, one algebraic step per beat, highlighting each changed term." | | Algorithm | "Animate [algorithm] on the array [list], showing comparisons and swaps." | | Comparison | "Show A vs B side by side, animating the difference." |

Five rules that improve every render

  1. Name real numbers. "n = 4, 10, 50" beats "increase n."
  2. One idea per beat. Crowded beats produce overlapping labels.
  3. State the audience. It sets vocabulary and pace.
  4. Ask for highlights. "Color the changed term yellow" mirrors the 3Blue1Brown style.
  5. Iterate one variable. If a beat is too fast, fix only that.

Worked example

"Visualize matrix multiplication as a transformation of the grid. Beat 1: show the unit grid and the matrix [[2,1],[0,1]]. Beat 2: apply it, watching basis vectors î and ĵ land. Beat 3: label the sheared grid. For a linear-algebra beginner."

That maps cleanly to Manim's NumberPlane + ApplyMatrix. See the full walkthrough in Visualize Matrix Multiplication.

Put it to work

→ Paste your prompt at quantumsketch.app and get a narrated render. New to the engine? Read Manim Without Code and How AI Narrates Math Videos.


Written by Shihab Shahriar Antor · Shahriar Labs

FAQ

Q.What makes a good prompt for an AI math animation?

A good prompt names four things: the concept, a visual metaphor, the sequence of beats, and the audience. Instead of 'explain integrals,' write 'show a Riemann sum approximating the area under y = x², with rectangles getting thinner as n goes from 4 to 50, for a first-year calculus student.' The concept is the integral, the metaphor is shrinking rectangles, the beats are the increasing n values, and the audience sets the vocabulary. Specificity gives the LLM enough structure to write correct Manim code and a matching narration script.

Q.How long should an AI animation prompt be?

Two to four sentences is the sweet spot. Too short ('animate eigenvectors') leaves the model guessing about layout and pacing. Too long becomes contradictory and hard to satisfy. Lead with the concept and metaphor, add 2–3 beats, and end with the audience level. If the first render is close but imperfect, refine one variable at a time — change the metaphor, slow a beat, or adjust the example numbers — rather than rewriting the whole prompt.

Tags:#ai#animation#manim#prompts
S

Shihab Shahriar

AI Engineer & Founder of Shahriar Labs. Exploring the intersection of design, cognition, and machine learning.