Ibiyemi Abiodun

« main page

Rain 2D

2D animation software GitHub repository

July 2017 to August 2018

c-sharpdirectxwpf

I was interested in trying out 2D animation, but I wasn’t really satisfied with any of the animation software that I could get my hands on for free. So I made my own 2D animation software:

Getting the GhostScript tiger to render properly in Rain 2D warranted a celebration! Not only that, you could edit it, too! Don't look at the frame time.

After working on this for over a year, I ended up with a Direct2D-based vector graphics editor that could open, modify, and save complex SVG files. It featured the usual cast of vector graphics tools such as gradient editors, a Bézier pen tool, and affine transformations.

What I learned

It was cool, but it was incredibly slow and could not animate in real time. In other words, I found out the hard way why the best animation software is expensive. The main solution I tried was using ReactiveX Observables to create a scene graph that would automatically re-render just the dirty regions when a property was changed.

A simple drawing used to test Rain 2D's editing tools.

It didn’t help that much, and in hindsight I think that may C# have been a poor choice of language for a project like this. In C#, every call to the Direct2D API required marshalling, and this was at least partially responsible for the performance ceiling that I encountered.

Besides that, I learned a lot about how graphics APIs work at a low level. I learned about algorithms like de Casteljau’s algorithm for turning curves into line segments, and I learned about how to tesselate polygons into triangles.