Shape

Shape

Base class representing shape Implement common methods of affine transformations

Constructor

new Shape()

Source:

Methods

rotate(angle, centeropt) → {Shape}

Returns new shape rotated by given angle around given center point. If center point is omitted, rotates around zero point (0,0). Positive value of angle defines rotation in counterclockwise direction, negative angle defines rotation in clockwise direction
Source:
Parameters:
Name Type Attributes Default Description
angle number angle in radians
center Point <optional>
(0,0) center
Returns:
Type:
Shape

scale(sx, sy) → {Shape}

Return new shape with coordinates multiplied by scaling factor
Source:
Parameters:
Name Type Description
sx number x-axis scaling factor
sy number y-axis scaling factor
Returns:
Type:
Shape

toJSON() → {Object}

This method returns an object that defines how data will be serialized when called JSON.stringify() method
Source:
Returns:
Type:
Object

translate(…args) → {Shape}

Returns new shape translated by given vector. Translation vector may be also defined by a pair of numbers.
Source:
Parameters:
Name Type Attributes Description
args <repeatable>
Returns:
Type:
Shape