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 🙏

© 2026 – Pkg Stats / Ryan Hefner

tiny-animator

v1.2.0

Published

Module to create interpolation between state with duration

Downloads

5

Readme

tiny-animator

CircleCI Status Codecov npm npm npm semantic-release

Make a interpolation between states' object with duration

Live example

Install

npm i tiny-animator --save
or
yarn add tiny-animator


Importing

import Animator from "tiny-animator";

Sample

usage animator plugin

script.js file

let coords = { x: 0, y: 0 };

let animate = Animator(
    coords,
    { x: 300, y: 300 },
    {
        duration: 1000,
        onComplete: () => {
            console.log("Animate completed !");
        }
    }
);

let start = null;

function play(timestamp) {
    if (start === null) start = timestamp;
    progress = timestamp - start;
    animate.update(progress);
    requestAnimationFrame(play);
}

requestAnimationFrame(play);

Implement

let animate = Animator(obj, target, duration);

| argument | type | Description | | :--------- | :------------------- | :----------------------------------------------------------- | | obj | object | Initial state ( ⚠️ don't use const. Module use reference ) | | target | object | Final state | | duration | number or object | number to number of steps and object to more option |

attributes' last argument object

const params = {
    duration: 1000,
    effect: (step) => step,
    onComplete: () => {
        console.log("Finiched");
    }
};

let animate = Animator(obj, target, params);

| argument | type | Description | | :----------- | :--------- | :---------------------------------------------------------------- | | duration | number | number of steps to arrive on the last state | | effect | function | call every update to treat time ( easeIn, easeOut, reverse, ... ) | | onComplete | function | call when duration |

attribut effect

Receive numbers range 0-1 and need send number range 0-1;

| number | description | | :----- | :----------------- | | 0 | initial state | | ... | intermediate state | | 1 | final state |

Exemples
const reverse = (num) => 1 - num;

const easeInOut = (num) => (Math.cos((num - 1) * Math.PI) + 1) / 2;

const easeIn = (num) => Math.abs(Math.log(num) / 2);

const easeOut = (num) => Math.log(num) / 2 + 1;

Methods

.restart()

init animate and enable function update

animate.restart();

.stop()

stop animate without launch onComplete and disable function update

animate.stop();

.update(num)

update state on the right time with current step

| argument | type | default | Description | | :------- | :------- | :------ | :------------------------------------- | | num | number | null | update state on progress interpolation |

The first call define step to 0, the next step will step up to the last one defined by duration

animate.update();

samples

With duration = 10

let cumulateTime = 0;
animate.update(cumulateTime); // update to 0% of interpolation

cumulateTime = 5;
animate.update(cumulateTime); // update to 50% of interpolation

With duration = 50

let cumulateTime = 0;
animate.update(cumulateTime); // update to 0% of interpolation

cumulateTime = 5;
animate.update(cumulateTime); // update to 10% of interpolation

With duration = 5 ( call update without argument )

animate.update(); // update to 0% of interpolation
animate.update(); // update to 25% of interpolation
animate.update(); // update to 50% of interpolation
animate.update(); // update to 75% of interpolation
animate.update(); // update to 100% of interpolation