Introduction
Wanim lets almost unmodified manim Python run in the browser—lightweight, fast, and convenient—and with only minor code changes, turns those scenes into interactive presentations far more powerful than plain animation. Nothing for your readers to install: no Python, no LaTeX, no server, and no tens-of-megabytes Pyodide runtime. See examples in our gallery and try it yourself in the playground.
For interactive features, see interactive controls. If you want an AI to write a wanim demo, copy that page into your LLM.
Every code block marked live on this site is compiled and played in your browser by the same runtime you can put on your own page.
Using the player
Every live block on this site is a player. Scenes with several pages show small buttons in the bottom-right corner of the canvas:
<goes to the previous page.↻replays the current page.>goes to the next page. In an interactive scene, this ends the blueprint and runs the animation.
Buttons that do not apply to the current page are hidden.
| Key | Action |
|---|---|
→ or Space | next page |
← | previous page |
↑ | replay this page |
When several players share a page, the shortcuts act on the canvas you clicked last.
What you can do with it
- Keep your manim code. Scenes, mobjects,
self.play,.animate,ValueTracker,MathTex, andThreeDScenework with their usual names and keyword arguments. The gallery runs a cross-section of the library, one scene after another. - Build interactive explanations.
InteractiveScenelets the reader drag sliders, flip switches, and type into number fields while your picture responds. When the reader is ready, the scene moves on to a normal animation. See interactive controls. - Put scenes anywhere a web page goes. Use the
<wanim-scene>element in plain HTML, an<iframe>that carries its code in the URL for blogs, or the JavaScript API for your own player or editor. See using wanim.
How it works, briefly
- The Python source is preprocessed. Imports of
manim,numpy,random,math, anditertoolsare mapped to browser equivalents, and a few constructs the compiler cannot parse are rewritten. - rapydscript-ng, a patched build, turns the result into JavaScript.
- The JavaScript runs against wanim's TypeScript port of manim and draws to a Canvas 2D context, one frame at a time.
Nothing leaves the page. The Python never reaches a server, and the code runs with the same permissions as any other script on the page. For the details, see for developers.
Status
wanim is an early preview.
- The npm package is named
@wanimjs/wanim. Import the parts you need by subpath, for example@wanimjs/wanim/bridgeforrunPythonOnCanvas. See using wanim for the list. - The API follows manim Community Edition. Where wanim differs, the docs say so. If a scene that runs in manim fails here, that is a bug worth reporting.
- Some manim features are not implemented yet. Expect gaps in less common corners of the API.
Where to go next
- Gallery: run the example scenes and read their code.
- Interactive controls: sliders, inputs, storyboards, and slides mode.
- Using wanim: embed a scene in your page.
- For developers: build the runtime and understand the pipeline.