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

groovin

v0.1.3

Published

animate javascript objects

Readme

Groovin

Groovin is a library bringing the power of CSS transitions to Javascript objects.
Just define the transitions like you would do in CSS and Groovin will do the rest for you!

Here is a basic example:

// a dummy object
const myObj = {
    width: 100,
    height: 200,
}

// define transitions for the properties you want to animate
groovin.bind(obj, {
    width: '1s sine-out',
    height: '0.5s circ-in 0.5s',
})

// and now you can simply change the properties' values and Groovin will transition them for you.
// now width will go from 100 to 400 in 1s with the easing function sine-out
myObj.width = 400;

// same for height
// height will go from 200 to 500 in 0.5s with the easing function circ-in and a delay of 0.5s
myObject.height = 500


// let's log the values to see what's happening
setInterval(function() {
    console.log(myObj.width, myObj.height);
});

Installation

Npm

npm install groovin

Yarn

yarn add groovin

Or you can use the files located in the "dist" directory.

Usage

// dummy object
const myObj = {
    width: 10,
    height: 10,
};

// bind an object with transitions
groovin.bind(obj, {
    // properties that will be animated
    width: '1s sine-out',
    height: '2s circ-in 1s',
    ... (all the properties you want)
}, {
    // (optional)
    // you can also add predefined "styles"
    normal: {
        width: 50,
        height: 100,
    },
    hover: {
        width: 100,
        height: 100,
    }
});


// simply set values to animate them
groovin.width = 20;
groovin.height = 30;


// you can also apply a predefined style
// what it simply does is setting the values defined in the predefined styles
groovin.style(obj, 'hover');


// unbind an object so it's not animated anymore
groovin.unbind(obj);


// unbind all objects
groovin.unbindAll();

Functions

groovin.bind(obj, transitions, style?)

Bind an object with transitions.
The transitions have the format: duration(s/ms) <easing(param)> <delay(s/ms)>

Example: 1.5s sine-out 0.3s (duration of 1.5s and delay of 0.3s)
Or: 500ms back-out(1.5) 200ms (duration of 500ms and delay of 200ms)

Duration & delay

Duration & delay can be in seconds (ex: 1s) or milliseconds (ex: 500ms)

Easing

Easing can have an optional parameter. It is totally optional.
Here is a list of all easing functions included, and their default parameter:

  • linear
  • sine-in
  • sine-out
  • sine-inout
  • quad-in
  • quad-out
  • quad-inout
  • cubic-in
  • cubic-out
  • cubic-inout
  • quart-in
  • quart-out
  • quart-inout
  • quint-in
  • quint-out
  • quint-inout
  • expo-in
  • expo-out
  • expo-inout
  • circ-in
  • circ-out
  • circ-inout
  • back-in(1.70158)
  • back-out(1.70158)
  • back-inout(1.70158)
  • elastic-in(0.7)
  • elastic-out(0.7)
  • elastic-inout(0.65)
  • bounce-in
  • bounce-out
  • bounce-inout

Example: 1.5s sine-out 0.3s (easing is sine-out)
Or: 500ms back-out(1.5) 200ms (easing in back-out with optional parameter 1.5)

You can find a reference to the easing functions used here: https://easings.net/

Styles

Predefined styles are optional follow this format:

{
    nameOfStyle: {
        property: value,
        ...
    },
    nameOfStyle2: {
        property: value,
        ...
    },
    ...
}


Example:

groovin.bind(obj, {
    width: '1s circ-out', // transition for "width" property
    height: '0.5s sine-in 0.5s', // transition for "height" property
}, {
    // style "normal"
    normal: {
        width: 50,
        height: 50,
    },
    // style "big"
    big: {
        width: 200,
        height: 200,
    }
})

// and you can switch between the different styles by calling:
groovin.style(obj, 'big');


Usage example with all the parameters:

groovin.bind(obj, {
    width: '1s sine-out',
    height: '0.5s circ-in 0.5s',
    left: '500ms back-out(2.5),
    top: '1.5s linear 300ms',
}, {
    normal: {
        width: 50,
        height: 50,
        left: 0,
        top: 0,
    },
    big: {
        width: 200,
        height: 200,
        left: 100,
        top: 200,
    }
})

groovin.style(obj, styleName)

Set a predefined style on an object.
It simply sets the values for the properties defined.
If the style does not exist, it does nothing.

groovin.style(myObj, 'hover');

groovin.unbind(obj)

Unbind an object so it's not animated anymore

groovin.unbind(myObj);

groovin.unbindAll()

Unbind all objects

groovin.unbindAll();