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
| Name | Description |
|---|---|
anchor | PointLikeThe 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 | numberChanges 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 | numberThe height of the TilingSprite, setting this will actually modify the scale to achieve the value set. |
instance | PIXI.TilingSpriteThe PIXI.TilingSprite instance. Can be set or bound to. |
pluginName | stringPlugin that is responsible for rendering this element. |
roundPixels | booleanIf 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.TextureThe texture of the tiling sprite. |
tilePosition | PointLikeThe offset of the image that is being tiled. |
tileTransform | PIXI.TransformTile transform |
uvMatrix | PIXI.TextureMatrixMatrix that is applied to UV to get the coords in Texture normalized space to coords in BaseTexture space. |
uvRespectAnchor | booleanFlags 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 | numberThe width of the sprite, setting this will actually modify the scale to achieve the value set. |
Additional props are passed on to Container
Slots
| Name | Props | Fallback |
|---|---|---|
| default | {} |
Events
| Name | Type | Detail |
|---|---|---|
| added | forwarded | |
| click | forwarded | |
| create | forwarded | |
| globalmousemove | forwarded | |
| globalpointermove | forwarded | |
| globaltouchmove | forwarded | |
| mousedown | forwarded | |
| mousemove | forwarded | |
| mouseout | forwarded | |
| mouseover | forwarded | |
| mouseup | forwarded | |
| mouseupoutside | forwarded | |
| pointercancel | forwarded | |
| pointerdown | forwarded | |
| pointermove | forwarded | |
| pointerout | forwarded | |
| pointerover | forwarded | |
| pointertap | forwarded | |
| pointerup | forwarded | |
| pointerupoutside | forwarded | |
| removed | forwarded | |
| removedFrom | forwarded | |
| rightclick | forwarded | |
| rightdown | forwarded | |
| rightup | forwarded | |
| rightupoutside | forwarded | |
| tap | forwarded | |
| touchcancel | forwarded | |
| touchend | forwarded | |
| touchendoutside | forwarded | |
| touchmove | forwarded | |
| touchstart | forwarded |