You are here

Hacking Manim: Adding Rounded Corners To Rectangles

Corey Pennycuff's picture

In case you did not know, Manim is an programmatic animation libary for Python, famously used for the beautifully designed mathematics instructional videos of the 3Blue1Brown YouTube channel.

My problem is that I wanted to use it to generate animations of a piano keyboard, and, in order for the keyboard to look correct, the keys should have rounded corners. On the bottom. And only on the bottom. And Manim couldn't do that.

Since Manim is open source, I decided to dig into it and try to fix the problem. Moreover, I realize that many newer programmers don't know how to approach contributing to an open source project, so this video is my attempt to demonstrate to newcomers how they, too, can hack/patch/submit and therefore become part of the open source community!

The goal is simple: Add support for multiple different radii within the same "round rectangles" command.

Spoiler alert: we succeed and the patch was accepted and is now part of the official Manim project!