A throughly unremarkable day. I made progress, nothing else to add. I had proposed to myself to write bits that I intend to publish upon release, so I’ll do that.

Behind the scenes


From the website:

Paper.js is an open source vector graphics scripting framework that runs on top of the HTML5 Canvas. It offers a clean Scene Graph / Document Object Model and a lot of powerful functionality to create and work with vector graphics and bezier curves, all neatly wrapped up in a well designed, consistent and clean programming interface.

This description is accurate, albeit vastly understated. Paper.js is incredibly intuitive for developers accustomed to working in vector editing applications. Layers, groups, boolean operations, primitives, blend modes, selections, segments, nodes; it’s all there. It’s fast, it’s clean and it’s a pleasure to use. My only regret is not having used it before.

I lost count of the times Paper.js surprised me by foreseeing my geometry needs. I’d think I want the coordinates of the bottom right corner, so I need to know the width and height of the object and add the current coordinates, let’s see how this is done… OH! item.bounds.bottomRight, sweet!

Other times I’d even have to replace my buggy implementations because I never expected to find my needs resolved by the library. I suffered greatly making a shape match the size of a rectangle, and then saw that item.fitBounds(rectangle) did exactly what I needed.

That said, I was also flustered by some things that didn’t behave the standard way in Javascript. I guess this is what they call “magic”. If I do…

item.style = { fillColor: "red" } item.style = { strokeColor: "red" }

Then item.style will be

{ fillColor: Color.instance, strokeColor: Color.instance }

But, after using the library extensively, I came to appreciate the convenience of this feature. And like this, there are many asterisks to the things you do Paper.js, particularly regarding functional programming. Always append a .slice() to group.children if you don’t want to shoot yourself in the foot, or simply do it the Paper.js way.

All in all, I’m very glad to have used this library and can’t recommend it highly enough. This game wouldn’t have been possible without the library. Jürg Lehni & Jonathan Puckey are nothing short of geniuses and I’m grateful to have such a powerful creative tool at my disposal.