FAQ

Our project needs feature X, could you implement it?

If we think it is a useful feature to have, we would be open to adding it to our roadmap. If you need it implemented in the short term, contact us to discuss ways to sponsor the development process.

Why not base it on SVG?

We have decided to use the Canvas object as the main backend because in our initial testing it was faster than SVG and allowed us to implement, optimize and have full control over our own Scene Graph / Document Object Model. SVG import / export is available and well tested. Refer to the next question.

How do I export as vector graphics?

Importing from and exporting to SVG is implemented in the library since Since November 2012. See project.importSVG(svg), item.importSVG(svg) / project.exportSVG(), item.exportSVG(). PDF exporting will hopefully be implemented in the future, possibly through an external library.

Aren't you cluttering the global namespace with lots of variables?

Don't worry, all of Paper.js is compiled in its own scope and housed within a global paper variable. Paper.js runs each of your PaperScript scripts within their own scope, which at the time of the execution appears to be the global scope but is in fact that paper object. If you choose to not use PaperScript and prefer plain JavaScript instead, you will lose the added benefit of expressing vector mathematics with Point and Size objects through simple math operators, and you will have to access all your prototypes on this paper object. You could choose to pollute the global scope by calling paper.install(window), injecting all the Paper.js prototypes into it and removing the need to access everything through the paper object.

What about the competition? Aren't there quite a few libraries out there that wrap around the Canvas already?

We are aware of the many Canvas wrappers out there, but we see Paper.js as much more than that. It is an extensive library that comes out of years of experience with vector graphics and API design for Scriptographer. It offers many highly useful tools to work with vector graphics that canvas lacks: A well designed scene graph and DOM, highly optimised and accurate mathematical calculations for lots of bezier related things, such as bounding box calculations (with and without stroke expansion, including all different stroke styles, even miter limits), curve and path length (using Gauss-Legendre numerical integration), path time parametrisation (finding bezier parameters at a given offset / length, using Newton-Raphson root finding), curve fitting, and fast path flattening, allowing us for example to replace Canvas' missing dashed line support with our own at near-native speed.

Why not just work with the HTML5 Canvas directly?

See the previous question for a list of added benefits of working with Paper.js

Can you use Paper.js without writing PaperScript?

Yes you can, but you lose some advantages such as auto-scoping and operator overloading, while winning others, e.g. easier debugging and slightly higher performance. The tutorial about Using JavaScript Directly describes the process. Both can also be mixed, as described in the tutorial about PaperScript Interoperability.