Two.Polygon

Extends: Two.Path

Constructor

ArgumentDescription
xThe x position of the polygon.
yThe y position of the polygon.
radiusThe radius value of the polygon.
sidesThe number of vertices used to construct the polygon.

Properties

A list of properties that are on every Two.Polygon.

fromObject

Returns: Two.Polygon

ArgumentDescription
objObject notation of a Two.Polygon to create a new instance

Create a new Two.Polygon from an object notation of a Two.Polygon.

nota-bene

Works in conjunction with Two.Polygon.toObject

radius

The radius value of the polygon.

nota-bene

This property is tied to Two.Polygon.width and Two.Polygon.height. When you set radius, it affects width and height. Likewise, if you set width or height it will change the radius.

width

The size of the width of the polygon.

nota-bene

This property is tied to Two.Polygon.radius. When you set radius, it affects the width. Likewise, if you set width it will change the radius.

height

The size of the height of the polygon.

nota-bene

This property is tied to Two.Polygon.radius. When you set radius, it affects the height. Likewise, if you set height it will change the radius.

sides

The amount of sides the polygon has.

copy

ArgumentDescription
polygonThe reference Two.Polygon

Copy the properties of one Two.Polygon onto another.

clone

Returns: Two.Polygon

ArgumentDescription
parentThe parent group or scene to add the clone to.

Create a new instance of Two.Polygon with the same properties of the current path.

toObject

Returns: Object

Return a JSON compatible plain object that represents the path.