Painting shapes in Javascript

elzapp picture elzapp · Jun 4, 2009 · Viewed 14.7k times · Source

Is there any good alternative to the html5-element canvas to paint shapes like hexagons using javascript, that works cross-browser (including the horrible IE6)?

I have been using jQuery and jQuery maphighlight for this, but it doesn't give me enough possibilities to manipulate the shapes and colors after it's first rendered.

Am I missing some features in jQuery maphighlight, or are there any other plugin for either jQuery or mootools, that can provide me with this painting capabilities?

Answer

jrista picture jrista · Jun 4, 2009

You should take a look at RaphaelJS. It is a JavaScript, cross-browser wrapper library around Canvas, SVG, and VML (an IE-only vector markup language that predates SVG, used in IE6). Using RaphaelJS, you can generate a very wide range of vector graphics using JS that is compatible with a very broad range of browsers.

http://raphaeljs.com/

RaphaelJS is also very compatible with jQuery, and follows a lot of the same call-chaining that you see in jQuery. The two make a great pair.