Skip to content

onTick

Child components of Ticker can use onTick to add a callback to the ticker. It will automatically remove itself on unmount.

<script>
  import { Text, onTick } from 'svelte-pixi'

  let text = 0

  onTick((delta) => {
    text = `Delta: ${delta.toFixed(10)}`
  })
</script>

<Text {text} style={{ fill: 'white' }} anchor={0.5} />

Type Definition

function onTick(fn: (delta: number) => any, priority?: number | undefined): void