Skip to content

Sprite

Sprites are the base for all textured objects that are rendered to the screen

Usage

<script>
import * as PIXI from 'pixi.js'
import { Sprite } from 'svelte-pixi'
</script>
<Sprite
texture={PIXI.Texture.from('/assets/adventurer.png')}
anchor={0.5}
scale={3}
/>

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.

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

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