Polygon

This display object is used for creating regular polygons. It supports any number of sides, so this object can for example be used to create a triangle.

Properties

radius : Number
The radius (circumradius) of the polygon.
side : Number
The length of a side.
sides : Number
The number of sides that the polygon will have.

Examples

Example 1

We start by creating a new core instance. Then we create a triangle by specifying a polygon with three sides.

View Example
Code
var canvas = oCanvas.create({
	canvas: "#canvas"
});

var triangle = canvas.display.polygon({
	x: 177,
	y: 145,
	sides: 3,
	radius: 80,
	rotation: 270,
	fill: "#0aa"
});

canvas.addChild(triangle);
Output