-
Notifications
You must be signed in to change notification settings - Fork 0
Home
catszeid edited this page Jun 7, 2017
·
1 revision
Instantiate a CanvasX object while passing in the id of the canvas you wish to use. Using this CanvasX object you can access the different functions that are built in to make drawing and filling basic shapes easier. You can still access the context being used by calling the ctx property of the canvasX object or the canvas itself with the canvas property.
var cx = new CanvasX("canvas");
// draw a rectangle
cx.drawRect(10,10,20,20);
// draw a polygon
var arr = new Array();
arr.push(new Point(10,10));
arr.push(new Point(50,50));
arr.push(new Point(10,50));
cx.drawPolygon(arr);