SpriteEntity
The SpriteEntity class extends Entity to render 2D images. It wraps a standard PIXI.Sprite or a PIXI.extras.TilingSprite for repeating patterns.
SpriteEntity
Extends Entity.
Properties
| Property | Type | Description |
|---|---|---|
sprite | PIXI.Sprite \| PIXI.extras.TilingSprite | The underlying PIXI sprite object. |
Methods
constructor()
function constructor(texture: string | PIXI.Texture, tiled?: boolean): voidCreates a new sprite entity. If texture is a string URL, it is converted into a PIXI.Texture. If tiled is true, it uses a TilingSprite with NEAREST scaling. The sprite's anchor is centered at (0.5, 0.5) by default.
getAnchor()
function getAnchor(): PIXI.ObservablePointReturns the anchor point of the sprite.
setAnchor()
function setAnchor(x: number, y: number): voidSets the anchor point of the sprite.
getTint()
function getTint(): numberReturns the tint color of the sprite.
setTint()
function setTint(tint: number): voidSets the tint color of the sprite.
getBlendMode()
function getBlendMode(): numberReturns the blend mode of the sprite.
setBlendMode()
function setBlendMode(blendMode: number): voidSets the blend mode of the sprite.
getMask()
function getMask(): PIXI.Graphics | PIXI.SpriteReturns the mask applied to the sprite.
setMask()
function setMask(entity: Entity): voidSets an entity to act as a mask for this sprite.
setDimensions()
function setDimensions(x: number, y: number, width: number, height: number): voidExplicitly sets the x/y position and width/height dimensions of the sprite.