Skip to content

Ticker

Children of this component can use onTick to hook into the update loop.

Usage

<script>
import { Ticker, Text } from 'svelte-pixi'
let delta = 0
let frame = 0
</script>
<Ticker
on:tick={(ev) => {
frame++
delta = ev.detail
}}
>
<Text
x={360}
y={200}
text={`Frame ${frame}\nDelta: ${delta.toFixed(10)}`}
style={{ fill: 'white' }}
anchor={0.5}
/>
</Ticker>

API

Props

NameDescription
autoStart
true
boolean

Whether or not this ticker starts automatically

instance
PIXI.Ticker

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

maxFPS
0
number

Manages the minimum amount of milliseconds required to elapse between invoking PIXI.Ticker#update. This will effect the measured value of PIXI.Ticker#FPS. If it is set to 0, then there is no limit; PixiJS will render as many frames as it can. Otherwise it will be at least minFPS

minFPS
10
number

Manages the maximum amount of milliseconds allowed to elapse between invoking PIXI.Ticker#update. This value is used to cap PIXI.Ticker#deltaTime, but does not effect the measured value of PIXI.Ticker#FPS. When setting this property it is clamped to a value between 0 and PIXI.settings.TARGET_FPMS * 1000.

priority
PIXI.UPDATE_PRIORITY

Priority of the ticker for on:tick event. Defaults to LOW

speed
1
number

Factor of current PIXI.Ticker#deltaTime.

Slots

NamePropsFallback
default{}

Events

NameTypeDetail
tickdispatched