Prototype Graphic Framework
Written by on April 11th, 2007 in Ajax News.
Sebastien Gruhier has created useful libraries such as the Prototype Window component.
Now, he has created the Prototype Graphic Framework (PGF) - a framework based on prototype to display vectorial shapes inside a web browser.
The framework has various renderers that sit on top of SVG, Canvas, and VML, so you can plug and play (although canvas support is limited right now).
JAVASCRIPT:
-
-
// Create an SVG renderer
-
var renderer = new SVGRenderer(”whiteboard”);
-
-
// Create a rectangle with some attributes like color and bounds
-
var rect = new Graphic.Rectangle(renderer);
-
rect.setFill({r: 255, g: 0, b: 0, a: 128});
-
rect.setStroke({r: 255, g: 255, b: 0, a: 128, w: 5});
-
rect.setBounds(10, 20, 200, 300);
-
rect.setRoundCorner(10, 10);
-
rect.translate(10, 20);
-
rect.rotate(30);
-
-
renderer.add(rect);
-
Source: Ajaxian
Original Article: http://ajaxian.com/archives/prototype-graphic-framework