# Shape

Base class representing shape Implement common methods of affine transformations

## Constructor

#### new Shape()

Source:
  - classes/shape.js, line 8

### 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:
  - classes/shape.js, line 42

##### 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:
  - classes/shape.js, line 52

##### 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:
  - classes/shape.js, line 65

##### Returns:

Type:
  `Object`

#### translate(vector, tx, ty) → {Shape}

Returns new shape translated by given vector. Translation vector may be also defined by a pair of numbers.

Source:
  - classes/shape.js, line 29

##### Parameters:

Name | Type | Description
--- | --- | ---
`vector` | `Vector` | Translation vector or
`tx` | `number` | Translation by x-axis
`ty` | `number` | Translation by y-axis

##### Returns:

Type:
  `Shape`