AI · Prompt

Claude 3 Manim Viewport Prompt

Prompt template for generating bounded Manim animation code with Claude

A structured prompt designed by Min Choi that directs Claude 3 to write clean, viewport-safe Python code using the Manim animation library. It specifies layout rules, positioning methods, and text sizing guidelines to prevent elements and narration from clipping out of frame.

The prompt

Prompt text: Using Manim, make an animation explaining the concept of [Desired Concept]. Ensure that the animation stays within the viewport by following these guidelines: 1. Use VGroup to group related objects together and manage them as a single unit. 2. Scale objects and groups using the scale() method to ensure they fit within the viewport. 3. Position objects and groups using methods like next_to(), shift(), and to_edge() to control their placement relative to other objects or the edges of the viewport. 4. Use appropriate buffering values when positioning objects to maintain sufficient spacing and avoid overlapping. 5. For text labels associated with specific objects or groups, position them relative to the corresponding object/group using next_to() with the desired direction (e.g., UP, DOWN, LEFT, RIGHT). Ensure that the labels are not overlapping the objects by adjusting the buffer values. 6. Ensure that text labels have a contrasting color and sufficient font size to be clearly visible against the background and other objects. 7. Break down the narration text into smaller segments that correspond to each animation step. Create separate Paragraph objects for each narration segment with a smaller font size and a specified width to ensure the text stays within the viewport. Position each text object at [truncated in screenshot] the bottom of the viewport using to_edge(DOWN, buff=0.5). 8. Use arrange() to layout multiple objects or groups horizontally or vertically with consistent spacing. 9. Adjust the camera settings, such as the frame_width and frame_height, to control the viewport size and aspect ratio if needed. 10. Test your animation at different resolutions and aspect ratios to ensure that objects remain within the viewport and are properly positioned across different devices. 11. Use the following animations for different purposes: Write: Animates the writing or appearance of text on the screen. [list truncated]

What it's for

  • Generate code for educational technical animations without elements rendering outside the frame
  • Animate technical concepts such as neural network architectures using Python and Manim
  • Standardize text placement and subtitles at the bottom of Manim scenes

Key points

  • Enforces VGroup usage to manage related objects as a single unit
  • Uses scale() and buffering constraints to keep shapes within bounds
  • Standardizes label positioning with next_to() and directional buffers
  • Breaks narration into segmented Paragraph objects aligned to the bottom edge
  • Adjusts frame width, height, and aspect ratios to match target viewport resolutions

Pricing

Free

Details

Type
Prompt
Category
AI
Topic
AI Prompts
Open source
No
Platforms
Web
For
Educators, content creators, and developers writing programmatic animations with Manim and LLMs
Tags
prompts, claude, manim, python, animation, data visualization

Why it was saved

  • @minchoi, 19 March 2024: Distilled over several iterations; lets Claude 3 reliably generate clean, viewport-safe Manim explainer animations. Choi notes it is not perfect and suggests talking to Claude to tweak it.

Related

All 47 in AI Prompts →

Updated