Two.Rectangle

Extends: Two.Path

Constructor

ArgumentDescription
xThe x position of the rectangle.
yThe y position of the rectangle.
widthThe width value of the rectangle.
heightThe width value of the rectangle.

fromObject

Returns: Two.Rectangle

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

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

nota-bene

Works in conjunction with Two.Rectangle.toObject

width

The size of the width of the rectangle.

height

The size of the height of the rectangle.

origin

A two-component vector describing the origin offset to draw the rectangle. Default is 0, 0.

copy

ArgumentDescription
rectangleThe reference Two.Rectangle

Copy the properties of one Two.Rectangle onto another.

clone

Returns: Two.Rectangle

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

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

toObject

Returns: Object

Return a JSON compatible plain object that represents the path.