NineSliceSprite
class NineSliceSprite extends Sprite
A NineSliceSprite is similar to a Sprite, but it uses 9-slice scaling to strech its inner area to fit the size of the Renderable,
by proportionally scaling a sprite by splitting it in a grid of nine parts (with only parts 1, 3, 7, 9 not being scaled).
Constructor
new NineSliceSprite(x: number, y: number, settings: object) → {}
this.panelSprite = new me.NineSliceSprite(0, 0, {
image : game.texture,
region : "grey_panel",
width : this.width,
height : this.height
});
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
x | number |
the x coordinates of the sprite object |
||
y | number |
the y coordinates of the sprite object |
||
settings | object |
Configuration parameters for the Sprite object |
||
settings.width | number |
the width of the Renderable over which the sprite needs to be stretched |
||
settings.height | number |
the height of the Renderable over which the sprite needs to be stretched |
||
settings.insetx | number |
<optional> |
the width of a corner over which the sprite is unscaled (default is a quarter of the sprite width) |
|
settings.insety | number |
<optional> |
the height of a corner over which the sprite is unscaled (default is a quarter of the sprite height) |
|
settings.image | HTMLImageElement | HTMLCanvasElement | TextureAtlas | string |
reference to spritesheet image, a texture atlas or to a texture atlas |
||
settings.name | string |
<optional> |
"" |
name of this object |
settings.region | string |
<optional> |
region name of a specific region to use when using a texture atlas, see TextureAtlas |
|
settings.framewidth | number |
<optional> |
Width of a single frame within the spritesheet |
|
settings.frameheight | number |
<optional> |
Height of a single frame within the spritesheet |
|
settings.tint | string | Color |
<optional> |
a tint to be applied to this sprite |
|
settings.flipX | number |
<optional> |
flip the sprite on the horizontal axis |
|
settings.flipY | number |
<optional> |
flip the sprite on the vertical axis |
|
settings.anchorPoint | Vector2d |
<optional> |
{x:0.5, y:0.5} |
Anchor point to draw the frame at (defaults to the center of the frame). |
Summary
Properties inherited from Sprite
boolean |
|
number |
|
boolean |
|
Vector2d |
|
TextureAtlas |
|
Properties inherited from Renderable
number |
|
boolean |
|
Container | Entity |
|
ObservableVector2d |
|
boolean |
|
string |
|
Body |
|
Matrix2d |
|
number |
|
boolean |
|
string |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
Rect | RoundRect | Polygon | Line | Ellipse |
|
string |
|
Function |
|
Application |
|
ObservableVector3d |
|
GLShader |
|
Color |
|
boolean |
|
Properties inherited from Rect
Methods inherited from Sprite
number |
|
Sprite |
|
number |
|
boolean |
|
boolean |
|
play or resume the current animation or video |
|
play or resume the current animation or video |
|
Sprite |
|
Sprite |
|
Sprite |
|
Sprite |
|
|
|
boolean |
|
Methods inherited from Renderable
Methods inherited from Rect
Rect |
|
Rect |
|
boolean |
|
Rect |
|
boolean |
|
boolean |
|
boolean |
|
Rect |
|
Rect |
|
Polygon |
|
Rect |
|
Methods inherited from Polygon
Array<number> |
|
boolean |
|
Polygon |
|
Polygon |
|
|
|
Polygon |
|
Polygon |
|
Polygon |
|