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 🙏

© 2025 – Pkg Stats / Ryan Hefner

choreographerjs

v0.1.1

Published

A JavaScript library for orchestrating complex sequences of browser animations.

Readme

Choreographer

Choreographer is a JavaScript library designed for orchestrating complex sequences of browser animations.

It sprouted from the development Randy's animation code, which sports numerous timed, sequential CSS transitions and animations. It became a big nuisance trying to dynamically coordinate all those animations using JavaScript, since JavaScript doesn't control CSS animations. When Promises and listening for transitionends became too messy, it became necessary to abstract away the coordination code into its own module. Thus, Choreographer!


Installation

Download the built file:

$ npm install choreographerjs

Documentation

Choreographer's raison d'être is to synchronize a long sequence of animations. It was designed to choreograph CSS animations, but should also work for JavaScript animations. It works by storing a map ("choreography") from times to (arrays of) animation functions. When the perform() method is invoked, the Choreographer loops through the keys of the map (which correspond to execution times) and creates a timeout that runs the stored animation functions at that time/key.

An example will make that more clear. Given this choreography

{
  0: [ fn1 ],
  300: [ fn2, fn3 ],
  600: [ fn4 ]
}

On invocation of Choreographer.perform(), three timeouts would be created:

setTimeout(function () { fn1(); }, 0);
setTimeout(function () { fn2(); fn3(); }, 300);
setTimeout(function () { fn4(); }, 600);

This allows each animation function to run in order, at its specified time. Presumably, the time interval between the keys of fn1 and fn2/fn3 is the length of time it takes for fn1 to complete.

API

Constructor

var choreographer = new Choreographer([duration]);

Creates a Choreographer. Optionally takes a positive integer argument to set as the default function duration.

Properties
  • duration — The default length (in milliseconds) of a single animation. If Choreographer.add() is called without a duration argument, it will default to this value. If this value is not passed to the constructor, it will be set to 300.

Add

Choreographer.add(fn, [duration]);

Adds a function at the current time, which is stored as a property of the Choreographer. Increases the current time by the value passed for duration. If nothing is passed, the current time will be increased by the default set when the Choreographer was instantiated. Pass a duration of 0 to refrain from increasing the time.

Arguments
  • fn — An animation function to add to the choreography.
  • duration — An optional duration corresponding to the length of time it takes for fn to complete, in milliseconds.

Pause

Choreographer.pause([duration]);

Creates a pause in the choreography by increasing the current time without adding any functions.

Arguments
  • duration — How long to pause (in milliseconds). Optional, and defaults to the value passed in the constructor.

Perform

Choreographer.perform();

Executes the functions stored in the choreography

License

GPLv2