Code Kurzgesagt-Style Science Animations
Make a narrated science animation with code, using a Kurzgesagt-inspired visual style. Trey’s prompt ties camera moves, character actions and sound cues to spoken words, then renders an MP4.
Requirements
- Python
- Playwright
- Edge
- GPU
- FFmpeg
Overview
What you get
- The complete author prompt and Chinese translation.
- A staged practice guide for narration timing, code-drawn scenes, previews and MP4 export.
Tutorial
Make changes happen on the words that explain them
A science animation needs more than drawings: changes should happen when viewers hear the explanation. This prompt asks Claude to draw characters, scenes and planets in code, aligning camera moves, counters and sound effects with spoken keywords. The landscape video takes visual inspiration from Kurzgesagt’s colors, depth and character acting, without using the channel’s own characters, bird or music.
Choosing between the approaches on this site
- Explain Ideas with Cartoon Characters and Scenes generates background and character images before animating them in code. This prompt asks for code-drawn visuals, with WebGL planets, suited to scenes needing precise control over light, scale and timing.
- Turn Topics into Paper-Style Cartoon Explainers emphasizes portrait paper textures and word-synced captions. This prompt emphasizes landscape scenes, camera movement and changes triggered by keywords.
The original video above explains why pirates wore eye patches, using a ship, an eye patch, eyes in darkness and a countdown. It demonstrates the explanation style; the attached prompt instead defaults to “What if the Sun vanished?” and specifies 30 seconds. The hosted video measures 1280×720, 30fps and about 67 seconds with audio. Keep those specifications separate from the prompt’s requested 1920×1080 output.
Copy the prompt and confirm the topic and tools
This is a prompt to give directly to an AI assistant, with no separate skill package to install. Start in a new folder with a Claude coding session that can create files and run Python and browser tools.
- Copy the complete prompt on this page into Claude. It will ask for the topic, duration and voice option.
- Ask it to check Python, Playwright, Edge, browser GPU access and FFmpeg. Local speech also needs kokoro-onnx and faster-whisper. Have the assistant provide installation commands for your system, then report whether the browser can draw WebGL and export a frame.
- If you have an ElevenLabs key, configure it locally for the production tools; otherwise choose the local voice option in the prompt. Audition one sentence for language, voice and pronunciation before generating the whole narration.
The original prompt is designed for English narration and Fredoka type. For another language, ask for a voice and font that support it. Base the duration on the actual voice sample rather than applying the English rate of 165 words per minute to every language.
Approve the narration and visual beats first
Begin with the default example’s central explanation: sunlight takes time to reach Earth. NASA’s Earth facts gives the scale as about eight minutes, a source you can use for this part of the script.
Add this Opuskill exercise request after the complete prompt:
Topic: If the Sun vanished, would Earth go dark immediately?
Goal: an approximately 30-second English science animation explaining that light takes time to travel
Treat the Sun’s disappearance as a thought experiment; check the facts before writing
Focus first on the Sun, light already in transit and Earth; omit unverified temperatures or numbers for other planets
Keep code-drawn visuals, camera moves and keyword-triggered actions
Use English narration and readable on-screen type
Voice option: [ElevenLabs / local voice; enter the option available to you]
Show the narration and shot plan, naming the visual change each keyword triggers; wait for my approval before building
- Check that the script answers one question: the event, the viewer’s initial expectation, light still in transit, the later change at Earth, then a return to the opening question.
- Give every shot a clear action. The Sun might shrink on “vanished,” photons continue on “in transit,” and the camera follow light toward the planet on “Earth.”
- Check what the on-screen counter measures. A few seconds of film can compress a real process, but label the accelerated time so viewers do not mistake playback seconds for physical time.
- Approve the script, audition the opening, then generate the full voice track and word timings. The prompt uses timestamps returned by ElevenLabs or word alignment from faster-whisper. Use actual positions in the final audio to place animation events.
The default example’s screen text, temperatures and planetary scenes belong to that example. Rewrite them for the new explanation rather than keeping shots that require unsupported numbers.
Build one shot with sound before extending the film
Make “the Sun disappears, but light is still travelling” clear before building the other shots. Send this request in the same conversation:
Build only the shot where the Sun vanishes but light is still in transit
Use the approved narration and its word timings
Shrink the Sun on “vanished”; keep previously emitted light moving toward Earth
Have the character look toward the main change, and keep labels off the light’s path
Show key frames and a preview with sound; wait for approval before extending the film
- Inspect the stills: are the Sun, light and Earth distinct? Is the globe clipped flat in close-up? Is the text complete and readable?
- Play the preview: do the Sun’s collapse, photon motion and camera movement match the voice? Does the character look at the action? Do effects obscure the narration?
- Name the object and trigger word in feedback: “The Sun shrinks too early; move it to ‘vanished’ and keep the following photon motion.” Extend the film after approving this shot.
The author uses a 2D Canvas for scenes and another WebGL Canvas for planets, with window.seek(t) to locate a frame. The original’s http://window.seek(t) is a function name that was interpreted as a link; ask the assistant to implement window.seek(t). An ambient clock controls stars, rotation and floating motion, while a separate story clock controls events, so a rewind need not reverse every background movement.
Review the film and export an MP4
- Ask Claude for a contact sheet covering every visual beat. Check text overlap, frame edges, globe clipping and whether countdown labels explain what is being measured.
- Play the whole film with sound. Check keyword alignment and whether music obscures speech. Choose music and effects licensed for your use, keeping their sources and license notes.
- Once approved, have the assistant follow the prompt: Playwright drives GPU-enabled Edge at 30fps, blends two subframes for motion blur, then FFmpeg encodes the MP4. The requested settings are CRF 16 for the master, CRF 20 for delivery, -14 LUFS loudness and -2.2dB true peak.
- Ask for the actual export command and file path. Open the MP4 and check duration, the 1920×1080 frame, ending, text and sound. Retain the HTML, narration, timestamps and rendering scripts for later edits.
Change one shot, then use your own topic
Practise a composition change first:
Only change the shot explaining that light is still in transit
Pull the camera back so the Sun’s former position, photon path and Earth are visible together
Move the label above the path so it does not cover the photons
Keep the narration, voice track, trigger words and shot duration
Show before-and-after key frames for this shot, then a preview with sound
Check that the photon motion is easy to follow, the label is readable, and all three objects remain in frame. If you also change the narration, regenerate the affected audio, update its word timings and review the related actions and sound cues.
For a different topic, supply a new brief rather than changing only the title:
Topic: [a what-if, cause or mechanism question]
Audience: [who it is for and what they may misunderstand]
Takeaway: [one specific conclusion]
Fact sources: [links, documents or local file paths]
Scene objects: [characters, objects and the changes between them]
Duration and language: [target seconds; narration and screen-text languages]
Voice option: [an available service or local voice]
Keep code drawing and keyword-triggered actions; rewrite scenes, numbers and counters for this topic
Approve the script, audition the voice, build one shot, then extend the film