jsDraw2D is a pure JavaScript library to draw 2D graphics on web pages inside web browser without using SVG or VML. JavaScript developers, web developers and webmasters can take advantage of the library to add graphics drawing functionality to their web applications or websites using the library. The library is entirely written in JavaScript and does not need any plug-in or additional software to run/execute. The JavaScript source code of the library is open and free under a “Creative Commons Attribution-Noncommercial 3.0 Unported” License.

jsDraw2D

The library provides the option to set co-ordinate system, origin, scale, and many other interesting features. Below a sample code using jsDraw2D :


//Create jsGraphics object
var gr = new jsGraphics(document.getElementById("canvas"));


//Create jsColor object
var col = new jsColor("red");


//Create jsPen object
var pen = new jsPen(col,1);


//Draw a Line between 2 points
var pt1 = new jsPoint(20,30);
var pt2 = new jsPoint(120,230);
gr.drawLine(pen,pt1,pt2);


//Draw filled circle with pt1 as center point and radius 30.
gr.fillCircle(col,pt1,30);


//You can also code with inline object instantiation like below
gr.drawLine(pen,new jsPoint(40,10),new jsPoint(70,150));