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

@damain/jsanimate

v0.1.2

Published

Programatic Javascript Animation Library

Readme

Project Aim

  • To create a chainable animation library for programmatic animation in javascript
  • Work inside of other javascript frameworks like React
  • Allow triggering of animations without using css classes

Demo

See demo on https://replit.com/@damain1/jsanimate-demo

Installation

Download minified version below and add as a script tag

https://github.com/damain/jsanimate/blob/main/jsanimate.min.js

or install via npm

npm install @damain/jsanimate

Basic Usage

Given the following html

<div id="animateMe">I will be animated</div>

In your Javascript

    import Jsanimate from "@damain/jsanimate"

    let elToAnimate = new Jsanimate("#animateMe")

    elToAnimate.rotate(45).run()

Please Note ⚠️

The constructor accepts any valid css selector or object with an HTMLElement (e.g. refs in React).

You need to call the run() method at the end in order for the animation to execute

Functionality

Here are the available methods

  • fade: fades element in and out using opacity, defaults to true

    elToAnimate.fade();
    elToAnimate.fade(false); // removes the fade animation
  • perspective: sets 3d perspective directly on element

    elToAnimate.perspective("200px");
    elToAnimate.perspective("nome"); // removes the perspective
  • reset: returns element to starting state

    elToAnimate.reset();
  • reverse: plays last animation in reverse

    elToAnimate.reverse();
  • rotate: turns in the 2d axis

    elToAnimate.rotate(45);
    elToAnimate.rotate({ angle: "45", add: true });
    // 3d versions
    elToAnimate.rotateX("45deg");
    elToAnimate.rotateY(".5turn");
    elToAnimate.rotateZ("45deg");
  • run: executes the animation

    elToAnimate.run();
    elToAnimate.run({ delay: 1000, iterations: 2 });
  • scale: changes the size of the element

    elToAnimate.scale(3);
    elToAnimate.scale({ x: 3, y: 3, add: true });
  • set3DPerspective: activates 3d perspective on the parent of the element to animate rotate and sets the perspective distance

    elToAnimate.set3DPerspective(true, "6cm")
  • translate: moves element alon the x and y axis

    elToAnimate.translate({x:3});
    elToAnimate.translate({ x: 3, y: 3, add: true });
    
    // 3d versions
    elToAnimate.translateX("45deg");
    elToAnimate.translateY(".5turn");
    elToAnimate.translateZ("45deg");
  • transformOrigin: sets the origin (pivot point) of the animation

    elToAnimate.transformOrigin("center");
    elToAnimate.transformOrigin("top right");

Chaining methods together

Methods can be chained together to compose more complex animations.

elToAnimate.rotate(45).translate({ x: 45, y: 45 }).run();

You can continue chaining after the run in order to specify another animation.

elToAnimate.rotate(45).translate({ x: 45, y: 60 }).run().scale(3).run({ delay: 1000 });

Lets break this down

This code does two animations. The first animation will rotate 45 degrees while moving 45px on the➡️ x axis and 60px on the ⬇️y axis. The second animation scales the element 3 times bigger after 1 second. Therefore the run element signals the end of the animation.

In the run method, you can specify animation keyframes options as an object. In the code above we specified the delay in milliseconds ...run({delay:1000})

You can specify the following keyframe options

| Option | Default | | ------------------ | -------------------------------- | | delay | 0 | | direction | "forwards" | | duration | 1000ms | | easing | "cubic-bezier(0.34, 1, 0.64, 1)" | | endDelay | 0 | | fill | "forwards" | | iterationStart | 0 | | iterations | 1 | | composite | "replace" | | iterationComposite | "replace" |

Beneath the hood

This library makes use of the Web Animations API to do CSS transformations on elements.

It works by using methods to set the end state of an animation, when run is called all the state changes are executed as one animation. Each method returns an instance of the class which allows all the methods to be chained similar to what you can do with JQuery or the way basic javascript array methods work.

Roadmap

  • Add skew functions
  • Create helper methods for simple animations e.g. fadeLeft, fadeUp, etc.