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

animation

v0.1.3

Published

animation timing & handling

Downloads

343

Readme

animation

Handles Animation Timing and Handling for you.

Uses requesAnimationFrame when running on browser side.

Installation

$ npm install animation

Usage

animation = new Animation({frame:'100ms'});
animation.on('tick', function (dt) { … });
animation.start();

surrender-cube uses this module to draw a rotating wireframe cube in terminal.

Animation

animation = new Animation({
    // defaults
    execution: '5ms', // allowed execution time per animation tick
    timeout:   null,  // maximum time of a animation tick interval
    toggle:    false, // if true animation pauses and resumes itself when render queue gets empty or filled
    frame:     '16ms' // time per frame
});

Creates a new Animation controller.

animation.start

animation.start();

Starts animation.

animation.stop

animation.stop();

Stops animation.

animation.pause

animation.pause();

When autotoggle is enabled the Animation pauses itself if the render queue is empty.

animation.resume

animation.resume();

When autotoggle is enabled the Animation resumes itself when the render queue gets filled again after it was emtpy.

animation.nextTick

animation.nextTick(function (dt) { … });

Given callback gets called on next animation tick when running and not paused.

Events

'start'

animation.on('start', function () { … });

Emits start event every time the animation gets started.

'stop'

animation.on('stop', function () { … });

Emits stop event every time the animation gets stopped.

'pause'

animation.on('pause', function () { … });

Emits pause event every time the animation gets paused.

'resume'

animation.on('resume', function () { … });

Emits resume event every time the animation gets resumed.

'tick'

animation.on('tick', function (dt) { … });

Emits tick event every time the animation executes a animation tick.

dt is the time since last animation tick.

Use this to do your animation stuff.