npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

pixi-timeout

v1.0.4

Published

Pixi.js plugin. A setTimeout replacement using PIXI.Ticker

Downloads

12

Readme

pixi-timeout

Pixi-timeout is a plugin which replicates the behaviour of window.setTimout but uses PIXI.Ticker (requestAnimationFrame) as the method for progressing time. The bonus is that any timeouts will be paused and resumed automatically when you call PIXI.Application.stop & PIXI.Application.start

Install

npm i pixi-timeout

Usage

Importing

common.js

require('pixi.js')
require('pixi-timeout')

es6 modules

import pixi from 'pixi.js'
import pixiTimeout from 'pixi-timeout'

Basic usage.

Simply supply the time to wait in seconds and the function to call upon completion

PIXI.setTimeout(
    2,          // delay in seconds
    callback    // completion handler
)

Clear

There are 2 ways to clear a timeout. First the traditional way

const timer = PIXI.setTimeout(2,callback)
PIXI.clearTimeout(timer)

or more conviniently

const timer = PIXI.setTimeout(2,callback)
timer.clear()

Finish

You can finish a timer immediately, which will simply cancel the timer and fire the callback.

timer.finish()

Pause & Resume

If you are using PIXI.Application for instantiation then all current timers are automatically paused and resumed when PIXI.Application.stop & PIXI.Application.start are called. Which is great for keeping audio, tweens and timeouts synchronised.

import pix from ‘pixi,js’
import pixiTimeout from 'pixi-timeout'

const myApp = new PIXI.Application()

myApp.stop() // pause
myApp.start() //resume

FPS, Speed & Time

pixi-timeout calculates time based on the PIXI.ticker settings. It assumes 60fps is the desired rate and uses the deltaTime value from last frame to this frame to determine the correct time progression. Additionally it uses the speed value from the PIXI.ticker, so if you wish to adjust the optimal fps you can do so by changing the PIXI.ticker value and pixi-timeout will adjust accordingly

PIXI.ticker docs