new Frame(texture, name, sourceIndex, x, y, width, height)
name | type | description |
---|---|---|
texture | Phaser.Textures.Texture |
The Texture this Frame is a part of. |
name | number | string |
The name of this Frame. The name is unique within the Texture. |
sourceIndex | number |
The index of the TextureSource that this Frame is a part of. |
x | number |
The x coordinate of the top-left of this Frame. |
y | number |
The y coordinate of the top-left of this Frame. |
width | number |
The width of this Frame. |
height | number |
The height of this Frame. |
Over-rides the Renderer setting. -1 = use Renderer Setting 0 = No rounding 1 = Round
The Canvas drawImage data object.
The x center of this frame, floored.
The y center of this frame, floored.
Any Frame specific custom data can be stored here.
Does this Frame have a custom pivot point?
The height of the area in the source image to cut.
The width of the area in the source image to cut.
X position within the source image to cut from.
Y position within the source image to cut from.
A reference to the Texture Source WebGL Texture that this Frame is using.
Half the height, floored. Precalculated for the renderer.
Half the width, floored. Precalculated for the renderer.
The rendering height of this Frame, taking trim into account.
If the Frame has scale9 border data, is it 3-slice or 9-slice data?
The name of this Frame. The name is unique within the Texture.
The horizontal pivot point of this Frame.
The vertical pivot point of this Frame.
The radius of the Frame (derived from sqrt(w * w + h * h) / 2)
The height of the Frame in its un-trimmed, un-padded state, as prepared in the art package, before being packed.
The width of the Frame in its un-trimmed, un-padded state, as prepared in the art package, before being packed.
CURRENTLY UNSUPPORTED
Is this frame is rotated or not in the Texture? Rotation allows you to use rotated frames in texture atlas packing. It has nothing to do with Sprite rotation.
Does the Frame have scale9 border data?
The TextureSource this Frame is part of.
The index of the TextureSource in the Texture sources array.
The Texture this Frame is a part of.
Is the Frame trimmed or not?
WebGL UV u0 value.
WebGL UV u1 value.
WebGL UV v0 value.
WebGL UV v1 value.
The rendering width of this Frame, taking trim into account.
The X rendering offset of this Frame, taking trim into account.
The Y rendering offset of this Frame, taking trim into account.
Clones this Frame into a new Frame object.
A clone of this Frame.
Destroys this Frame by nulling its reference to the parent Texture and and data objects.
Takes a crop data object and, based on the rectangular region given, calculates the required UV coordinates in order to crop this Frame for WebGL and Canvas rendering.
The crop size as well as coordinates can not exceed the the size of the frame.
This is called directly by the Game Object Texture Components setCrop
method.
Please use that method to crop a Game Object.
name | type | description |
---|---|---|
crop | object |
The crop data object. This is the |
x | number |
The x coordinate to start the crop from. Cannot be negative or exceed the Frame width. |
y | number |
The y coordinate to start the crop from. Cannot be negative or exceed the Frame height. |
width | number |
The width of the crop rectangle. Cannot exceed the Frame width. |
height | number |
The height of the crop rectangle. Cannot exceed the Frame height. |
flipX | boolean |
Does the parent Game Object have flipX set? |
flipY | boolean |
Does the parent Game Object have flipY set? |
The updated crop data object.
Sets the x and y position within the source image to cut from.
name | type | arguments | description |
---|---|---|---|
x | number | <optional> |
X position within the source image to cut from. |
y | number | <optional> |
Y position within the source image to cut from. |
This Frame object.
Sets the width, and height of the area in the source image to cut.
name | type | description |
---|---|---|
width | number |
The width of the area in the source image to cut. |
height | number |
The height of the area in the source image to cut. |
This Frame object.
Sets the scale9 center rectangle values.
Scale9 is a feature of Texture Packer, allowing you to define a nine-slice scaling grid.
This is set automatically by the JSONArray and JSONHash parsers.
name | type | description |
---|---|---|
x | number |
The left coordinate of the center scale9 rectangle. |
y | number |
The top coordinate of the center scale9 rectangle. |
width | number |
The width of the center scale9 rectangle. |
height | number |
The height coordinate of the center scale9 rectangle. |
This Frame object.
Sets the width, height, x and y of this Frame.
This is called automatically by the constructor and should rarely be changed on-the-fly.
name | type | arguments | description |
---|---|---|---|
width | number |
The width of the frame before being trimmed. |
|
height | number |
The height of the frame before being trimmed. |
|
x | number | <optional> |
The x coordinate of the top-left of this Frame. |
y | number | <optional> |
The y coordinate of the top-left of this Frame. |
This Frame object.
If the frame was trimmed when added to the Texture Atlas, this records the trim and source data.
name | type | description |
---|---|---|
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. |
This Frame object.
Directly sets the canvas and WebGL UV data for this frame.
Use this if you need to override the values that are generated automatically when the Frame is created.
name | type | description |
---|---|---|
width | number |
Width of this frame for the Canvas data. |
height | number |
Height of this frame for the Canvas data. |
u0 | number |
UV u0 value. |
v0 | number |
UV v0 value. |
u1 | number |
UV u1 value. |
v1 | number |
UV v1 value. |
This Frame object.
Takes a crop data object and recalculates the UVs based on the dimensions inside the crop object.
Called automatically by setFrame
.
name | type | description |
---|---|---|
crop | object |
The crop data object. This is the |
flipX | boolean |
Does the parent Game Object have flipX set? |
flipY | boolean |
Does the parent Game Object have flipY set? |
The updated crop data object.
Updates the internal WebGL UV cache and the drawImage cache.
This Frame object.
Updates the internal WebGL UV cache.
This Frame object.