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:
Members
-
bottom
-
- Source:
Properties:
Name Type Description bottomnumber The bottom of the frame (y + height).
-
centerX
-
- Source:
Properties:
Name Type Description centerXnumber Center X position within the image to cut from.
-
centerY
-
- Source:
Properties:
Name Type Description centerYnumber Center Y position within the image to cut from.
-
distance
-
- Source:
Properties:
Name Type Description distancenumber The distance from the top left to the bottom-right of this Frame.
-
height
-
- Source:
Properties:
Name Type Description heightnumber Height of the frame.
-
index
-
- Source:
Properties:
Name Type Description indexnumber The index of this Frame within the FrameData set it is being added to.
-
name
-
- Source:
Properties:
Name Type Description namestring Useful for Texture Atlas files (is set to the filename value).
-
right
-
- Source:
Properties:
Name Type Description rightnumber The right of the Frame (x + width).
-
rotated
-
- Default Value:
- false
- Source:
Properties:
Name Type Description rotatedboolean Rotated? (not yet implemented)
-
rotationDirection
-
- Default Value:
- 'cw'
- Source:
Properties:
Name Type Description rotationDirectionstring Either 'cw' or 'ccw', rotation is always 90 degrees.
-
sourceSizeH
-
- Source:
Properties:
Name Type Description sourceSizeHnumber Height of the original sprite.
-
sourceSizeW
-
- Source:
Properties:
Name Type Description sourceSizeWnumber Width of the original sprite.
-
spriteSourceSizeH
-
- Default Value:
- 0
- Source:
Properties:
Name Type Description spriteSourceSizeHnumber Height of the trimmed sprite.
-
spriteSourceSizeW
-
- Default Value:
- 0
- Source:
Properties:
Name Type Description spriteSourceSizeWnumber Width of the trimmed sprite.
-
spriteSourceSizeX
-
- Default Value:
- 0
- Source:
Properties:
Name Type Description spriteSourceSizeXnumber X position of the trimmed sprite inside original sprite.
-
spriteSourceSizeY
-
- Default Value:
- 0
- Source:
Properties:
Name Type Description spriteSourceSizeYnumber Y position of the trimmed sprite inside original sprite.
-
trimmed
-
- Default Value:
- false
- Source:
Properties:
Name Type Description trimmedboolean Was it trimmed when packed?
-
uuid
-
- Source:
Properties:
Name Type Description uuidstring DEPRECATED: A link to the PIXI.TextureCache entry.
-
width
-
- Source:
Properties:
Name Type Description widthnumber Width of the frame.
-
x
-
- Source:
Properties:
Name Type Description xnumber X position within the image to cut from.
-
y
-
- Source:
Properties:
Name Type Description ynumber Y position within the image to cut from.
Methods
-
getRect(out) → {Phaser.Rectangle}
-
Returns a Rectangle set to the dimensions of this Frame.
Parameters:
Name Type Argument Description outPhaser.Rectangle <optional>
A rectangle to copy the frame dimensions to.
- Source:
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 trimmedboolean If this frame was trimmed or not.
actualWidthnumber The width of the frame before being trimmed.
actualHeightnumber The height of the frame before being trimmed.
destXnumber The destination X position of the trimmed frame for display.
destYnumber The destination Y position of the trimmed frame for display.
destWidthnumber The destination width of the trimmed frame for display.
destHeightnumber The destination height of the trimmed frame for display.
- Source: