Sprite
Creates a PIXI.Sprite
Sprites are the base for all textured objects that are rendered to the screen
Usage
<script> import { Sprite, Loader } from 'svelte-pixi' import * as PIXI from 'pixi.js' </script> <Sprite texture={PIXI.Texture.from('/assets/adventurer.png')} anchor={0.5} scale={2} x={200} y={200} />
Component API
Props
Name | Type | Default | Description |
---|---|---|---|
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. |
||
instance | PIXI.Sprite
|
The PIXI.Sprite 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 that the sprite is using. |
Additional props are passed on to Container
Slots
Name | Props | Fallback |
---|---|---|
default |
Events
Name | Type | Detail |
---|---|---|
added | forwarded |
|
click | forwarded |
|
create | 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 |