#

API Documentation for: NEXT
Show: Inherited Protected Private Deprecated

# Rectangle Class

Defined in: `Rectangle:39`
Module: EaselJS

Represents a rectangle as defined by the points (x, y) and (x+width, y+height).

#### Example

     var rect = new createjs.Rectangle(0, 0, 100, 100);

## Constructor

### `Rectangle`

(

- `[x=0]`
- `[y=0]`
- `[width=0]`
- `[height=0]`

)

Defined in `Rectangle:39`

#### Parameters:

- `[x=0]` Number optional

  X position.

- `[y=0]` Number optional

  Y position.

- `[width=0]` Number optional

  The width of the Rectangle.

- `[height=0]` Number optional

  The height of the Rectangle.

- Index
- Methods
- Properties

## Item Index

### Methods

- clone
- copy
- initialize
- toString

### Properties

- height
- width
- x
- y

## Methods

### `clone`

() Rectangle

Defined in `clone:116`

Returns a clone of the Rectangle instance.

#### Returns:

Rectangle:

a clone of the Rectangle instance.

### `copy`

(

- `rectangle`

)
Rectangle

Defined in `copy:106`

Copies all properties from the specified rectangle to this rectangle.

#### Parameters:

- `rectangle` Rectangle

  The rectangle to copy properties from.

#### Returns:

Rectangle:

This rectangle. Useful for chaining method calls.

### `initialize`

(

- `[x=0]`
- `[y=0]`
- `[width=0]`
- `[height=0]`

)
Rectangle

Defined in `initialize:88`

Initialization method. Can also be used to reinitialize the instance.

#### Parameters:

- `[x=0]` Number optional

  X position.

- `[y=0]` Number optional

  Y position.

- `[width=0]` Number optional

  The width of the Rectangle.

- `[height=0]` Number optional

  The height of the Rectangle.

#### Returns:

Rectangle:

This instance. Useful for chaining method calls.

### `toString`

() String

Defined in `toString:125`

Returns a string representation of this object.

#### Returns:

String:

a string representation of the instance.

## Properties

### `height`

Number

Defined in `height:80`

Height.

### `width`

Number

Defined in `width:73`

Width.

### `x`

Number

Defined in `x:59`

X position.

### `y`

Number

Defined in `y:66`

Y position.