Show HN: Wanim – Embed interactive 3Blue1Brown-style animations in your blog (github.com)

1 points by Acfboy ↗ HN
Hi HN, I love 3Blue1Brown's animations and Manim, the Python animation engine behind them. So I wanted to run it in my blog to build interactive animations. But that wasn't easy. Running it with Pyodide is too heavy.

I came up with a new approach: by patching rapydscript-ng (a tool that transpiles Python-like syntax to JS), I make it translate Manim code into JS, and pair it with a companion JS library. This lets it run the original code in a small enough bundle.

Fortunately, after overcoming some difficulties, it worked! It runs surprisingly well. You can see a blog I built here: https://wanim.org/blog , or try running your own Manim animations at https://wanim.org/playground.

2 comments

[ 3.6 ms ] story [ 10.2 ms ] thread
Interesting. Past few months I also tried bringing the flexibility of Python to the browser. My first attempt was a DSL with a Python wrapper. However in my second attempt I completely got rid of the DSL. I run Python directly in the browser with pyodide. Time to first run is high but it is amortized with more usage. Also open sourced it: https://pie.tinyvolt.com/
Wow, your project looks really cool. Unlike your goal of running general Python, Manim (the animation engine behind 3Blue1Brown) is essentially a DSL. I looked at publicly available Manim code and found it rarely needs other libraries or complex Python features beyond numpy, so I don't need Pyodide. I only have to transpile it and support numpy.