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

animatesprite

v0.2.1

Published

Sprite animations made simple

Downloads

7

Readme

animateSprite

Sprite animations made simple

This is a work in progress, not ready for production. Please check the TODO list before doing anything serious with it.

Getting started

With Browserify

$ npm install --save animatesprite
var AnimateSprite = require('animatesprite');
var animation = new AnimateSprite(document.getElementById('domWithSprite'));

Browser

Download the production version or the development version.

In your web page:

<script src="dist/animatesprite.min.js"></script>
<script>
var animation = new AnimateSprite(document.getElementById('domWithSprite'), {
    fps: 12,
    animations: {
        walkRight: [0, 1, 2, 3, 4, 5, 6, 7],
        walkLeft: [15, 14, 13, 12, 11, 10, 9, 8]
    },
    loop: true,
    complete: function(){
        // use complete only when you set animations with 'loop: false'
        alert("animation End");
    }
});
</script>
Settings
    fps:            int     // define animation speed
    complete:       function // called after the animation has finished (not called if loop is set to true)
    loop:           bool    // if the animation has to loop
    autoplay:       bool    // if the animation starts immediately
    animations:     object  // Contains multiple animations.
                            // The key should be the name of the animation,
                            // and the value should be an array with the frames.
Methods
    animation.play('animatinName')      // plays the specified animation
    animation.stop()                    // stops the animation
    animation.resume()                  // continues the animation from the point where it was stopped
    animation.restart()                 // starts the animation from the beginning
    animation.frame()                   // returns animation current frame
    animation.frame(n)                  // sets the frame to 'n'
    animation.settings()                // returns animation settings
    animation.settings({fps: 2})        // changes the desired configuration key

TODO

This javascript module is not ready for a release yet:

  • frame method sets what I call animation key (position from the current animation), but returns animation frame (frame defined by the user).
  • Some cleanup needs to be done, and give some consistency to know private variables from public ones.
  • It should plug in nicely with jQuery so it can replace jQuery.animateSprite.

License

MIT © Blai Pratdesaba