PIXI.TilingSprite
class TilingSprite extends PIXI.Sprite
A tiling sprite is a fast way of rendering a tiling image.
Constructor
new PIXI.TilingSprite(texture: PIXI.Texture, width: number, height: number) → {}
| Name | Type | Default | Description |
|---|---|---|---|
| texture | PIXI.Texture |
The texture of the tiling sprite. |
|
| width | number | 100 |
The width of the tiling sprite. |
| height | number | 100 |
The height of the tiling sprite. |
Summary
Properties from TilingSprite
| number |
|
| number |
The height of the TilingSprite, setting this will actually modify the scale to achieve the value set. |
| string |
|
| PIXI.ObservablePoint |
The offset of the image that is being tiled. |
| PIXI.ObservablePoint |
The scaling of the image that is being tiled. |
| PIXI.Transform |
Tile transform |
| PIXI.TextureMatrix |
Matrix that is applied to UV to get the coords in Texture normalized space to coords in BaseTexture space. |
| boolean |
|
| number |
The width of the sprite, setting this will actually modify the scale to achieve the value set. |
Methods from TilingSprite
| PIXI.TilingSprite |
|
| boolean |
|
| void |
|
| PIXI.Rectangle |
|
| void |
Updates the bounds of the tiling sprite. |
| void |
|
| void |
|
Properties inherited from Sprite
| PIXI.ObservablePoint |
|
| PIXI.BLEND_MODES |
|
| boolean |
|
| boolean |
If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation. |
| PIXI.Texture |
The texture that the sprite is using. |
| number |
The tint applied to the sprite. This is a hex value. |
| PIXI.ObservablePoint |
|
| number |
|
| number |
|
| HTMLCanvasElement |
|
| number |
|
| Float32Array |
|
| Float32Array |
|
Properties inherited from Container
| T[] |
|
| boolean |
|
| boolean |
|
| boolean |
Should children be sorted by zIndex at the next updateTransform call. |
Properties inherited from DisplayObject
Methods inherited from Sprite
| void |
Calculates worldTransform * vertices for a non texture with a trim. store it in vertexTrimmedData. |
| void |
Calculates worldTransform * vertices, store it in vertexData. |
Methods inherited from Container
Methods inherited from DisplayObject
Inherited Events from Container
Inherited Events from DisplayObject
|
|
|
|
|
|
|
|
|
|
Capture phase equivalent of |
|
|
|
|
|
|
|
|
Capture phase equivalent of |
|
|
Fired when the mouse pointer is moved over a DisplayObject and its descendant's hit testing boundaries. |
|
|
Capture phase equivalent of |
|
|
Fired when the mouse pointer exits a DisplayObject and its descendants. |
|
|
Capture phase equivalent of |
|
|
|
|
|
Capture phase equivalent of |
|
|
|
|
|
Capture phase equivalent of |
|
|
|
|
|
Capture phase equivalent of |
|
|
|
|
|
Capture phase equivalent of |
|
|
|
|
|
Capture phase equivalent of |
|
|
|
|
|
Capture phase equivalent of |
|
|
|
|
|
Capture phase equivalent of |
|
|
Fired when the pointer is moved over a DisplayObject and its descendant's hit testing boundaries. |
|
|
Capture phase equivalent of |
|
|
Fired when the pointer leaves the hit testing boundaries of a DisplayObject and its descendants. |
|
|
Capture phase equivalent of |
|
|
|
|
|
Capture phase equivalent of |
|
|
|
|
|
Capture phase equivalent of |
|
|
|
|
|
Capture phase equivalent of |
|
|
|
|
|
Capture phase equivalent of |
|
|
|
|
|
Capture phase equivalent of |
|
|
|
|
|
Capture phase equivalent of |
|
|
|
|
|
|
|
|
Capture phase equivalent of |
|
|
|
|
|
Capture phase equivalent of |
|
|
|
|
|
Capture phase equivalent of |
|
|
|
|
|
Capture phase equivalent of |
|
|
|
|
|
Capture phase equivalent of |
|
|
|
|
|
Capture phase equivalent of |
|
|
|
|
|
Capture phase equivalent of |
|
|
|
|
|
Capture phase equivalent of |
|
|
|
|
|
Capture phase equivalent of |
|
|
|
|
|
Capture phase equivalent of |
|
| PIXI.FederatedWheelEvent |
Fired when a the user scrolls with the mouse cursor over a DisplayObject. |
| PIXI.FederatedWheelEvent |
Capture phase equivalent of |
Public Properties
clampMargin: number = 0.5
Changes frame clamping in corresponding textureTransform, shortcut Change to -0.5 to add a pixel to the edge, recommended for transparent trimmed textures in atlas
height: number
The height of the TilingSprite, setting this will actually modify the scale to achieve the value set.
pluginName: string = 'tilingSprite'
Plugin that is responsible for rendering this element. Allows to customize the rendering process without overriding '_render' method.
tilePosition: PIXI.ObservablePoint
The offset of the image that is being tiled.
tileScale: PIXI.ObservablePoint
The scaling of the image that is being tiled.
uvMatrix: PIXI.TextureMatrix
Matrix that is applied to UV to get the coords in Texture normalized space to coords in BaseTexture space.
uvRespectAnchor: boolean = false
Flags whether the tiling pattern should originate from the origin instead of the top-left corner in local space.
This will make the texture coordinates assigned to each vertex dependent on the value of the anchor. Without this, the top-left corner always gets the (0, 0) texture coordinate.
width: number
The width of the sprite, setting this will actually modify the scale to achieve the value set.
Public Methods
static from(source: string | PIXI.Texture | HTMLCanvasElement | HTMLVideoElement, options: object) → {PIXI.TilingSprite}
Helper function that creates a new tiling sprite based on the source you provide. The source can be - frame id, image url, video url, canvas element, video element, base texture
| Name | Type | Description |
|---|---|---|
| source | string | PIXI.Texture | HTMLCanvasElement | HTMLVideoElement |
Source to create texture from |
| options | object |
See PIXI.BaseTexture's constructor for options. |
| options.width | number |
required width of the tiling sprite |
| options.height | number |
required height of the tiling sprite |
| Type | Description |
|---|---|
| PIXI.TilingSprite |
The newly created texture |
containsPoint(point: IPointData) → {boolean}
Checks if a point is inside this tiling sprite.
| Name | Type | Description |
|---|---|---|
| point | IPointData |
The point to check. |
| Type | Description |
|---|---|
| boolean |
Whether or not the sprite contains the point. |
destroy(options: object | boolean) → {void}
Destroys this sprite and optionally its texture and children
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
| options | object | boolean |
<optional> |
Options parameter. A boolean will act as if all options have been set to that value |
|
| options.children | boolean |
<optional> |
false |
if set to true, all the children will have their destroy method called as well. 'options' will be passed on to those calls. |
| options.texture | boolean |
<optional> |
false |
Should it destroy the current texture of the sprite as well |
| options.baseTexture | boolean |
<optional> |
false |
Should it destroy the base texture of the sprite as well |
| Type | Description |
|---|---|
| void |
getLocalBounds(rect: PIXI.Rectangle) → {PIXI.Rectangle}
Gets the local bounds of the sprite object.
| Name | Type | Attributes | Description |
|---|---|---|---|
| rect | PIXI.Rectangle |
<optional> |
Optional output rectangle. |
| Type | Description |
|---|---|
| PIXI.Rectangle |
The bounds. |
Protected Methods
protected _calculateBounds() → {void}
Updates the bounds of the tiling sprite.
| Type | Description |
|---|---|
| void |
protected _onTextureUpdate() → {void}
| Type | Description |
|---|---|
| void |
protected _render(renderer: PIXI.Renderer) → {void}
Renders the object using the WebGL renderer
| Name | Type | Description |
|---|---|---|
| renderer | PIXI.Renderer |
The renderer |
| Type | Description |
|---|---|
| void |
protected _renderCanvas(renderer: PIXI.CanvasRenderer) → {void}
Renders the object using the Canvas renderer
| Name | Type | Description |
|---|---|---|
| renderer | PIXI.CanvasRenderer |
a reference to the canvas renderer |
| Type | Description |
|---|---|
| void |