{
 "version": 1,
 "template": "You are an expert Manim animator and a gifted teacher in the style of 3Blue1Brown. Write ONE complete, runnable Python file that teaches the topic below so well that the audience finishes the video able to explain the idea to a friend.\n\nTOPIC: [TOPIC]\nAUDIENCE: [AUDIENCE]\nENGINE: [ENGINE]\nLENGTH: about [LENGTH]\nSTYLE: [STYLE]\nKEY EQUATIONS (use exactly these, and build them up on screen): [EQUATIONS]\nNARRATION: [NARRATION]\nMUST INCLUDE OR AVOID: [EXTRAS]\n\nSTEP 1. PLAN BEFORE YOU CODE\nWrite the plan first, in a few lines:\n- The one idea of this scene, in one sentence. If it needs \"and\", it is two scenes: pick the first.\n- 4 to 6 beats: hook (a question or a striking picture), set-up (the objects), mechanism (what moves or changes), reveal (the equation or result), wrap-up.\n- One concrete example with real numbers BEFORE any general formula. Let the numbers become the variables, then the law.\n- A colour for every quantity (for example: main object blue, the thing being measured yellow, the result green, warning or heat red). The same colour always means the same quantity.\n\nSTEP 2. WRITE THE CODE TO THESE RULES\nEngine\n- ManimGX: the first line is \"import manimgx as m\" (plus \"import numpy as np\" if used). EVERY name carries the m. prefix (m.Circle, m.Create, m.UP, m.BLUE_C, m.PI). Never write \"from manim import *\". Scenes derive from m.Scene. m.MathTex takes LaTeX-style text and needs no LaTeX installation.\n- Manim Community Edition: \"from manim import *\", scenes derive from Scene, names have no prefix.\nStructure\n- Start with a docstring: the one idea, then the beats.\n- Then imports, palette constants (named, with a short comment) and small helper functions for anything drawn more than once.\n- One Scene class. \"def construct(self) -> None\". Each beat is a commented block that starts with self.next_section(\"Beat name\", notes=\"what to say here\").\n- Name things for what they are (radius_line, trace), never obj1.\nTeaching\n- Show first, then name: the object appears, then its label, then the equation built from the picture, never pasted in fully formed.\n- Anything that varies uses a ValueTracker with always_redraw (read tracker.get_value() inside the lambda).\n- Use Transform / ReplacementTransform / TransformFromCopy for \"this becomes that\". Use TransformMatchingTex or separate MathTex parts so each symbol keeps the colour of the quantity it stands for.\n- Direct attention with Indicate, Circumscribe or Flash. Fade unrelated things down instead of adding clutter.\n- Almost no text: labels of 8 words or fewer, one caption line at a time, never a paragraph or a bullet list. A symbol, colour or arrow beats a sentence.\nMaths\n- Write formulas as raw strings: MathTex(r\"\\frac{a}{b}\"). Keep each formula short and split long ones into parts.\n- Every number on screen must be right. Compute values with Python (math or numpy) and format them; never type an approximation you have not checked. Check units and signs.\nLayout\n- The frame is about 14.2 wide and 8 tall. Keep everything inside x from -6.3 to 6.3 and y from -3.4 to 3.4.\n- Title: to_edge(UP, buff=0.35). Caption or equation: to_edge(DOWN, buff=0.45). Keep at least 0.25 of space between a label and anything else. Never put text over a shape by accident. Labels are at least font_size 22.\n- Position with to_edge, next_to, arrange and move_to rather than guessed coordinates. Walk through the final frame of every beat and check nothing overlaps or leaves the frame.\nColour\n- Follow STYLE. Use at most 4 colours, as named constants, reused everywhere. Suggested roles: calm main (BLUE_C), emphasis (YELLOW), result or \"good\" (GREEN_C), heat, error or \"bad\" (RED_C or ORANGE), guides and small text (GREY_B).\nPacing\n- Pace like a person talking: run_time 1 to 1.5 s for ordinary steps, 2 to 3 s for the key moment. self.wait(0.5) after small steps, self.wait(1.5) after a big reveal, a final self.wait(1.5). Nothing shorter than 0.4 s except tiny nudges. Fit the total to LENGTH.\nReliability (most failures come from these)\n- Use only functions and constants that really exist. Do not invent helpers.\n- Never reuse a mobject after FadeOut or Uncreate unless you add it again. Call .clear_updaters() before transforming something that has an updater. Use .copy() when the original must stay.\n- Add always_redraw objects with self.add(...) or FadeIn before animating the tracker that drives them.\n- No files, network, subprocesses, eval or exec. Randomness only with a fixed seed. Every while loop must clearly end.\n- The file must run exactly as written: every import present, every name defined.\nNarration (only when NARRATION asks for it)\n- ManimGX: use self.say(\"The slope of [the tangent] is [two x].\", m.Indicate(tangent), m.Write(label)). The sentence is spoken and each animation plays while its bracketed words are said (the brackets are not spoken). Sentences are short, one idea each, written for the ear. Do not set a voice or a key: just call self.say.\n- Manim Community Edition: put the spoken script in the notes= of each next_section instead.\n- Budget about 2.3 spoken words per second of LENGTH, and leave a short silence after every big reveal.\n\nSTEP 3. CHECK YOURSELF, THEN ANSWER\nBefore replying, silently go through this and fix anything that fails:\n[ ] One idea, stated in the docstring.   [ ] Every beat has next_section.   [ ] Every name is real and every import present.\n[ ] Palette constants at the top, colours used consistently.   [ ] Nothing overlaps or leaves the frame at the end of any beat.\n[ ] Every number and equation is correct.   [ ] Labels are short and the picture does the explaining.   [ ] Final wait is there.\n\nHOW TO ANSWER\n1. A plain-language plan: what the scene shows in 2 to 4 sentences, then the beats as a short list.\n2. ONE Python code block holding the complete file, ready to run.\n3. One to three short bullets on easy tweaks (timing, colours, numbers). No lecture on Python.",
 "fields": [
  {
   "key": "TOPIC",
   "label": "Topic",
   "type": "text",
   "default": "",
   "placeholder": "e.g. why the area of a circle is pi r squared",
   "hint": "One idea, in a short phrase."
  },
  {
   "key": "AUDIENCE",
   "label": "Who is watching",
   "type": "text",
   "default": "a curious first-year student seeing this for the first time",
   "hint": "Say what they already know. It sets the pace."
  },
  {
   "key": "ENGINE",
   "label": "Engine",
   "type": "select",
   "options": [
    "ManimGX",
    "Manim Community Edition"
   ],
   "default": "ManimGX",
   "hint": "Manimo runs both. ManimGX is the default."
  },
  {
   "key": "LENGTH",
   "label": "Length",
   "type": "select",
   "options": [
    "30 seconds",
    "45 seconds",
    "60 seconds",
    "90 seconds"
   ],
   "default": "60 seconds",
   "hint": "Seconds. 45 to 60 suits one idea."
  },
  {
   "key": "STYLE",
   "label": "Style",
   "type": "select",
   "options": [
    "3Blue1Brown look: dark background, calm blue as the main colour, yellow for emphasis",
    "Clean chalkboard: dark grey background, white lines, one accent colour, very little decoration",
    "Bright classroom: light background, bold deep colours, large labels for a projector"
   ],
   "default": "3Blue1Brown look: dark background, calm blue as the main colour, yellow for emphasis",
   "custom": "Something else: I will describe it",
   "hint": "Or choose the last option and describe your own."
  },
  {
   "key": "EQUATIONS",
   "label": "Key equations",
   "type": "area",
   "default": "",
   "empty": "none given: choose the standard ones, state them in your plan, and double-check them",
   "placeholder": "e.g. A = \\pi r^2",
   "hint": "Paste them as LaTeX, in the order they should appear."
  },
  {
   "key": "NARRATION",
   "label": "Narration",
   "type": "select",
   "options": [
    "yes: a spoken script timed to the animation",
    "no: captions only"
   ],
   "default": "yes: a spoken script timed to the animation",
   "hint": "Manimo reads self.say() lines aloud with its built-in voices."
  },
  {
   "key": "EXTRAS",
   "label": "Must include or avoid",
   "type": "area",
   "default": "",
   "empty": "none",
   "placeholder": "e.g. use 3, 4, 5 as the worked example; no 3D",
   "hint": "Real numbers for the worked example help most."
  }
 ],
 "library": [
  {
   "id": "pythagoras",
   "subject": "Maths",
   "title": "The Pythagorean theorem",
   "line": "Squares on the sides of a right triangle, rearranged to prove it.",
   "topic": "why a squared plus b squared equals c squared in a right triangle",
   "length": "60 seconds",
   "equations": "a^2 + b^2 = c^2",
   "extras": "Worked example: sides 3, 4 and 5, with areas 9 + 16 = 25. Prove it by rearranging four copies of the triangle inside a big square, not by algebra alone."
  },
  {
   "id": "derivative",
   "subject": "Maths",
   "title": "The derivative as a slope",
   "line": "A tangent line slides along a curve and its slope is read off live.",
   "topic": "the derivative of a function as the slope of its tangent line",
   "length": "60 seconds",
   "equations": "f(x) = x^2 \\qquad f'(x) = \\lim_{h \\to 0} \\frac{f(x+h) - f(x)}{h} = 2x",
   "extras": "Slide a tangent along y = x^2 with a live slope readout. Then shrink a secant line into the tangent as h goes to 0. Plot f'(x) = 2x as the slope readout is traced."
  },
  {
   "id": "circle-area",
   "subject": "Maths",
   "title": "Area of a circle",
   "line": "Unroll rings of a circle into a triangle.",
   "topic": "why the area of a circle is pi r squared",
   "length": "60 seconds",
   "equations": "A = \\tfrac{1}{2}\\,(2\\pi r)\\,r = \\pi r^2",
   "extras": "Cut the circle into thin rings, unroll them side by side into a triangle with base 2 pi r and height r. Use r = 2 for the example."
  },
  {
   "id": "rc-charging",
   "subject": "Physics",
   "title": "Charging a capacitor",
   "line": "A circuit fills a capacitor while its voltage curve grows.",
   "topic": "charging a capacitor through a resistor",
   "length": "60 seconds",
   "equations": "V_C(t) = V_0\\left(1 - e^{-t/RC}\\right) \\qquad \\tau = RC",
   "extras": "Worked example: R = 10 kilohm, C = 100 microfarad, so tau = 1 s. Mark the point t = tau where V_C reaches 63 percent of V_0, and show the curve is almost full by 5 tau. Draw the circuit and the graph side by side."
  },
  {
   "id": "projectile",
   "subject": "Physics",
   "title": "Projectile motion",
   "line": "Horizontal and vertical motion combine into a parabola.",
   "topic": "projectile motion: horizontal and vertical motion are independent",
   "length": "60 seconds",
   "equations": "x(t) = v_0 \\cos\\theta \\; t \\qquad y(t) = v_0 \\sin\\theta \\; t - \\tfrac{1}{2} g t^2",
   "extras": "Worked example: v0 = 20 m/s, angle 45 degrees, g = 9.8 m/s^2, so the range is about 40.8 m and the peak height about 10.2 m (compute them in code). Show the velocity split into x and y arrows and a faded trail of the path."
  },
  {
   "id": "shm",
   "subject": "Physics",
   "title": "Simple harmonic motion",
   "line": "A mass on a spring, its position traced as a cosine wave.",
   "topic": "simple harmonic motion of a mass on a spring",
   "length": "60 seconds",
   "equations": "x(t) = A\\cos(\\omega t) \\qquad \\omega = \\sqrt{k/m} \\qquad T = \\frac{2\\pi}{\\omega}",
   "extras": "Worked example: m = 1 kg, k = 4 N/m, so omega = 2 rad/s and T is about 3.14 s. Draw the spring and mass on the left, and trace x against t on the right as the mass moves."
  }
 ],
 "followups": [
  {
   "id": "fix",
   "title": "Fix an error",
   "text": "The code below fails with this error. Change only what is needed to fix it, keep my names and structure, and return the complete file.\n\nERROR:\n[PASTE THE ERROR]\n\nCODE:\n[PASTE THE CODE]"
  },
  {
   "id": "layout",
   "title": "Tidy the layout and pacing",
   "text": "Here is a Manim scene. Without changing what it teaches: (1) fix any text that overlaps something or leaves the frame, (2) slow down the key reveal and add a pause after it, (3) make every label at least font_size 22 and 8 words or fewer, (4) keep my names and colours. Return the complete file.\n\nCODE:\n[PASTE THE CODE]"
  },
  {
   "id": "narrate",
   "title": "Add narration",
   "text": "Add narration to this ManimGX scene with self.say(...): one short sentence per beat, written for the ear, with the words in [square brackets] marking when each animation starts. Use about 2.3 spoken words per second of the video. Do not change the visuals. Return the complete file.\n\nCODE:\n[PASTE THE CODE]"
  }
 ]
}