Constructor
new Sprite($parameters)
- Description:
- Creates a new sprite.
- Source:
Examples
// minimal
const sprite = new Sprite({
$sizeTarget: new Vector2(32, 32),
$textureColor: textureColor
});
// full
const sprite = new Sprite({
$frameSource: new AABB(new Vector2(0, 0), new Vector2(1, 1)),
$sizeTarget: new Vector2(32, 32),
$textureColor: textureColor,
$textureOpacity: textureOpacity
});
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
$parameters |
Object | The given parameters. | |
$parameters.$frameSource |
AABB |
<optional> |
The frame to use from the texture sources (with values in [0, 1] ranges) (if not specified then the full texture is used). |
$parameters.$sizeTarget |
Vector2 | The target size. | |
$parameters.$textureColor |
string | The color texture source. | |
$parameters.$textureOpacity |
string |
<optional> |
The opacity texture source. |
Members
frameSource :AABB
- Description:
- Gets the frame to use from the texture sources.
- Source:
Gets the frame to use from the texture sources.
Type:
frameSourceSerialized :string
- Description:
- Gets the serialized value of the frame to use from the texture sources.
- Source:
Gets the serialized value of the frame to use from the texture sources.
Type:
- string
sizeTarget :Vector2
- Description:
- Gets the target size.
- Source:
Gets the target size.
Type:
textureColor :string
- Description:
- Gets the color texture source.
- Source:
Gets the color texture source.
Type:
- string
textureOpacity :string
- Description:
- Gets the opacity texture source.
- Source:
Gets the opacity texture source.
Type:
- string