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

re-animator

v1.0.5

Published

Simple animator using CSS3 animations

Downloads

3

Readme

Re-Animator

Re-Animator is a simple library to animation DOM nodes using CSS3 animations. The global namespace in non commonJS env is ReAnimator

The API is the following :

  • changeGlobalTimeout(value) : change the global timeout after which animation are ended no matter what
  • hide(node: string, cssClass: string, timeout: int, callback: function) : hides a dom node after animation end
  • show(node: string, cssClass: string, timeout: int, [display]: string, callback: function) : shows a dom node after animation end
  • animate(node: string, cssClass: string, timeout: int, callback: function) : animate a dom node
  • animateElement(node: string, cssClass: string, options: object) : animate a dom node
  • animateElements(nodes: string, cssClass: string, options: object) : animate dom nodes
  • transition(nodes: string, baseClass: string, options: object) : add baseClass class to nodes and in the next tick add ${baseClass}-active to trigger animation. Use options timeout to remove both classes.

node arguments can be string (querySelector) or HtmlElement. nodes arguments can be string (querySelectorAll) or NodeList. cssClass arguments can be string or array of string.

options on animateElement are :

  • before : callback before the start of the animation
  • after: callback after the end of the animation
  • timeout : after the timeout, css class will be remove from the node even if the animation is not done or did not even happens.

options on animateElements are :

  • beforeAll : callback before the start of the animation of every node
  • afterAll : callback after the end of the animation of every node
  • beforeItem : callback before the start of the animation of each node
  • afterItem : callback after the end of the animation for each node
  • timeout : after the timeout, css class will be remove from the nodes even if the animation is not done or did not even happens.

Example

@keyframes loop {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(359deg);
  }
}
.loop {
  animation: loop 1s;
  animation-iteration-count: 5;
}
@keyframes fadeout {
  0% {
    opacity: 1.0;
  }
  100% {
    opacity: 0.0;
  }
}
.fadeout {
  animation-name: fadeout;
  animation-duration: 0.3s;
  animation-timing-function: ease-in-out;
}
@keyframes fadein {
  0% {
    opacity: 0.0;
  }
  100% {
    opacity: 1.0;
  }
}
.fadein {
  animation-name: fadein;
  animation-duration: 0.3s;
  animation-timing-function: ease-in-out;
}
@keyframes scale {
  0% {
    width: 50px;
  }
  100% {
    width: 100px;
  }
}
.scale {
  animation-name: scale;
  animation-duration: 0.4s;
  animation-timing-function: ease-in-out;
}
<div style="display: flex; flex-direction: column">
  <div style="padding: 50px 50px 50px 50px">
    <div id="part" style="width: 50px; height: 50px; background-color: blue"></div>
  </div>
  <div style="padding: 50px 50px 50px 50px; display: flex; flex-direction: column">
    <div class="parts" style="margin-bottom: 10px; width: 50px; height: 50px; background-color: red"></div>
    <div class="parts" style="margin-bottom: 10px; width: 50px; height: 50px; background-color: red"></div>
    <div class="parts" style="margin-bottom: 10px; width: 50px; height: 50px; background-color: red"></div>
  </div>
</div>
ReAnimator.animateElement('#part', 'loop', { timeout: 6000 });

ReAnimator.animateElements('.parts', 'loop', { timeout: 6000 });

ReAnimator.hide('#part', 'fade-out', 1000, function() {
  console.log('done');
});

ReAnimator.show('#part', 'fade-in', 1000, function() {
  console.log('done');
});

ReAnimator.animate('#part', 'scale', 1000, function() {
  console.log('done');
});