Skip to content
A JQuery-less rewrite of -- usable in Node or in-browser.
Find file
Pull request Compare This branch is even with chrisdickinson:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Keyframely (a jQuery-less Runloop)

A rewrite of runloop that removes the dependency on jQuery. Props to KuraFire for the original -- it's an awesome idea.


In node:

var puts = require('util').puts,
    loop = require('keyframely').loop;

var ourLoop = loop(Math.round.bind(Math), loop.easings.cubic_out);

ourLoop.addKey('0%', function(ctls) {
ourLoop.addKey('6%', function(ctls) {
ourLoop.addKey('24%', function(ctls) {
ourLoop.addKey('55%', function(ctls) {
});, function(ctls) {

Or in browser:

<script src="keyframely.js"></script>
<script type="text/javascript">
    var ourLoop = keyframely.loop();
    ourLoop.addKey('50%', function(ctls) {
        document.write('HALLO WORLD');
    });, function(ctls) {
        document.write('No really hello.');

The biggest deviation from the original api is that a control object is passed to the keyframe callback. It provides the following:

  • quit: Quits the loop immediately.
  • pause: Pauses the loop. Resume the loop using play on the controls object.
  • play: Continues playing the loop.

This is done so that key frames can be retrieved and used on other loops using getMap and addMap, respectively.


New BSD.


Runloop is a great idea, and could be used to simulate, for example, request latency in Node. Unfortunately, since it is written as a jQuery plugin, it eschews that possibility out of the gate. No ill will intended! I just want to be able to use it when I don't have access to jQuery :)

Something went wrong with that request. Please try again.