Skip to content

TilingSprite

Usage

<script>
import { onMount } from 'svelte'
import { TilingSprite, AssetsLoader, onTick } from 'svelte-pixi'
import * as PIXI from 'pixi.js'
let count = 0
let scale = { x: 1, y: 1 }
let tilePosition = { x: 0, y: 0 }
onTick((delta) => {
count += 0.01 * delta
scale = { x: 2 + Math.sin(count), y: 2 + Math.cos(count) }
tilePosition = { x: tilePosition.x + 1, y: tilePosition.y + 1 }
})
</script>
<TilingSprite
texture={PIXI.Texture.from('/assets/tiling-sprite.jpeg')}
anchor={0.5}
width={400}
height={400}
{tilePosition}
{scale}
/>

API

Props

NameDescription
anchor
PointLike

The anchor sets the origin point of the text.

blendMode

The blend mode to be applied to the sprite. Apply a value of PIXI.BLEND_MODES.NORMAL to reset the blend mode.

clampMargin
0.5
number

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.

instance
PIXI.TilingSprite

The PIXI.TilingSprite instance. Can be set or bound to.

pluginName
string

Plugin that is responsible for rendering this element.

roundPixels
boolean

If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation. Advantages can include sharper image quality (like text) and faster rendering on canvas. The main disadvantage is movement of objects may appear less smooth.

texture
PIXI.Texture

The texture of the tiling sprite.

tilePosition
PointLike

The offset of the image that is being tiled.

tileTransform
PIXI.Transform

Tile transform

uvMatrix
PIXI.TextureMatrix

Matrix that is applied to UV to get the coords in Texture normalized space to coords in BaseTexture space.

uvRespectAnchor
boolean

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.

Additional props are passed on to Container

Slots

NamePropsFallback
default{}

Events

NameTypeDetail
addedforwarded
clickforwarded
createforwarded
globalmousemoveforwarded
globalpointermoveforwarded
globaltouchmoveforwarded
mousedownforwarded
mousemoveforwarded
mouseoutforwarded
mouseoverforwarded
mouseupforwarded
mouseupoutsideforwarded
pointercancelforwarded
pointerdownforwarded
pointermoveforwarded
pointeroutforwarded
pointeroverforwarded
pointertapforwarded
pointerupforwarded
pointerupoutsideforwarded
removedforwarded
removedFromforwarded
rightclickforwarded
rightdownforwarded
rightupforwarded
rightupoutsideforwarded
tapforwarded
touchcancelforwarded
touchendforwarded
touchendoutsideforwarded
touchmoveforwarded
touchstartforwarded