gitmyhub

raphael

JavaScript ★ 11k updated 2y ago

JavaScript Vector Library

Raphael is a JavaScript library for drawing and animating vector graphics in any web browser using a simple API, hiding the differences between browser implementations so you don't have to.

JavaScriptNode.jsYarnsetup: easycomplexity 2/5

Raphael is a JavaScript library for drawing vector graphics inside a web browser. Vector graphics are drawings made from mathematical shapes rather than pixels, which means they stay sharp at any size and can be animated or changed programmatically. This library was built to make that kind of drawing work across many different browsers without the developer needing to know the internal differences between each one.

The library depends on a small companion package called eve for event handling, and it ships in several ready-to-use file formats. You can include a single bundled file that already contains that dependency, or a lighter version that leaves the dependency out if you are loading it separately. Both minified (smaller, faster) and unminified (readable, easier to debug) variants are provided.

To use Raphael in a project, you load it via a standard HTML script tag or through a module system like AMD. You then create a drawing canvas on any part of your page and use the library's functions to draw shapes, paths, text, and images, and to attach click or animation events to them. A separate boilerplate project linked from the README shows working examples of how to load and set it up.

Building the library from source requires Node.js and Yarn, and tests are run by opening an HTML file in a browser rather than through an automated test runner. The project notes that browser compatibility review takes time, so pull requests may wait for community feedback before being merged. The license is MIT, meaning you can use it freely in commercial and personal projects. Several books covering Raphael in depth were published by O'Reilly and are listed in the README for anyone who wants a thorough reference.

Where it fits