# Class: Frame

## Phaser. Frame

Phaser.Frame

#### new Frame(index, x, y, width, height, name, uuid)

  A Frame is a single frame of an animation and is part of a FrameData collection.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `index` | number | The index of this Frame within the FrameData set it is being added to.
  `x` | number | X position of the frame within the texture image.
  `y` | number | Y position of the frame within the texture image.
  `width` | number | Width of the frame within the texture image.
  `height` | number | Height of the frame within the texture image.
  `name` | string | The name of the frame. In Texture Atlas data this is usually set to the filename.
  `uuid` | string | Internal UUID key.

  Source:
    - animation/Frame.js, line 20

### Members

#### centerX

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `centerX` | number | Center X position within the image to cut from.

  Source:
    - animation/Frame.js, line 60

#### centerY

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `centerY` | number | Center Y position within the image to cut from.

  Source:
    - animation/Frame.js, line 65

#### distance

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `distance` | number | The distance from the top left to the bottom-right of this Frame.

  Source:
    - animation/Frame.js, line 70

#### height

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `height` | number | Height of the frame.

  Source:
    - animation/Frame.js, line 45

#### index

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `index` | number | The index of this Frame within the FrameData set it is being added to.

  Source:
    - animation/Frame.js, line 25

#### name

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `name` | string | Useful for Texture Atlas files (is set to the filename value).

  Source:
    - animation/Frame.js, line 50

#### rotated

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `rotated` | boolean | Rotated? (not yet implemented)

  Default Value:
    - false
  Source:
    - animation/Frame.js, line 76

#### rotationDirection

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `rotationDirection` | string | Either 'cw' or 'ccw', rotation is always 90 degrees.

  Default Value:
    - 'cw'
  Source:
    - animation/Frame.js, line 82

#### sourceSizeH

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `sourceSizeH` | number | Height of the original sprite.

  Source:
    - animation/Frame.js, line 98

#### sourceSizeW

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `sourceSizeW` | number | Width of the original sprite.

  Source:
    - animation/Frame.js, line 93

#### spriteSourceSizeH

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `spriteSourceSizeH` | number | Height of the trimmed sprite.

  Default Value:
    - 0
  Source:
    - animation/Frame.js, line 122

#### spriteSourceSizeW

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `spriteSourceSizeW` | number | Width of the trimmed sprite.

  Default Value:
    - 0
  Source:
    - animation/Frame.js, line 116

#### spriteSourceSizeX

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `spriteSourceSizeX` | number | X position of the trimmed sprite inside original sprite.

  Default Value:
    - 0
  Source:
    - animation/Frame.js, line 104

#### spriteSourceSizeY

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `spriteSourceSizeY` | number | Y position of the trimmed sprite inside original sprite.

  Default Value:
    - 0
  Source:
    - animation/Frame.js, line 110

#### trimmed

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `trimmed` | boolean | Was it trimmed when packed?

  Default Value:
    - false
  Source:
    - animation/Frame.js, line 88

#### uuid

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `uuid` | string | A link to the PIXI.TextureCache entry.

  Source:
    - animation/Frame.js, line 55

#### width

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `width` | number | Width of the frame.

  Source:
    - animation/Frame.js, line 40

#### x

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `x` | number | X position within the image to cut from.

  Source:
    - animation/Frame.js, line 30

#### y

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `y` | number | Y position within the image to cut from.

  Source:
    - animation/Frame.js, line 35

### Methods

#### getRect(out) → {Phaser.Rectangle}

  Returns a Rectangle set to the dimensions of this Frame.

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `out` | Phaser.Rectangle | <optional> | A rectangle to copy the frame dimensions to.

  Source:
    - animation/Frame.js, line 160

  ##### Returns:

  A rectangle.

  Type
    Phaser.Rectangle

#### setTrim(trimmed, actualWidth, actualHeight, destX, destY, destWidth, destHeight)

  If the frame was trimmed when added to the Texture Atlas this records the trim and source data.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `trimmed` | boolean | If this frame was trimmed or not.
  `actualWidth` | number | The width of the frame before being trimmed.
  `actualHeight` | number | The height of the frame before being trimmed.
  `destX` | number | The destination X position of the trimmed frame for display.
  `destY` | number | The destination Y position of the trimmed frame for display.
  `destWidth` | number | The destination width of the trimmed frame for display.
  `destHeight` | number | The destination height of the trimmed frame for display.

  Source:
    - animation/Frame.js, line 128