Raphaël is a JavaScript library designed to simplify working with vector graphics on the web. It uses SVG for modern browsers (Firefox, Safari, Chrome, Opera) and VML for older Internet Explorer, providing a consistent API across different rendering engines. The current stable version is 2.3.0, released in 2018. The library is largely considered feature-complete but is no longer actively maintained, with the last code changes dating back several years. Key differentiators include its cross-browser compatibility, especially its VML fallback for legacy IE, and its relatively small footprint. Development is dormant, with releases historically occurring sporadically as PRs were gathered and tested. It relies on the `eve` library for custom event handling.
npm install raphaelVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize a Raphaël canvas, draw basic shapes like circles and rectangles, and add text to the canvas using a simple HTML file with a CDN import.
Avoid direct calls to `R.ninja`. Review usage if migrating from older versions; this method was not part of the public API.
For new projects, consider actively maintained alternatives like SVG.js, Paper.js, or Snap.svg. For existing projects, thoroughly test across target browsers and use polyfills if necessary.
Ensure `eve` is loaded *before* `raphael.no-deps.js` when using the no-deps distribution, typically via a separate script tag or an AMD/CommonJS module loader.
Update any bookmarks or references to `https://dmitrybaranovskiy.github.io/raphael/` for the current project page.
Ensure `<script src="path/to/raphael.js"></script>` is placed before any code attempting to use `Raphael`. For bundled environments, use `const Raphael = require('raphael');` and ensure your bundler processes it correctly.Load `eve.js` from `https://cdnjs.cloudflare.com/ajax/libs/eve/0.4.2/eve.min.js` (or a similar source) before loading `raphael.no-deps.js`. Alternatively, use the standard `raphael.js` (or `.min.js`) distribution, which includes `eve`.
Ensure the target DOM element for the Raphaël canvas exists and is accessible when `Raphael(element, width, height)` is called. Wrap your Raphaël initialization code in a `window.onload` or `DOMContentLoaded` event listener if executed from the `<head>`.