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

text-animation-js

v0.0.4

Published

A small animation library inspired by this [tweet](https://twitter.com/Twitch/status/1237174754118905856).

Downloads

2

Readme

Text Animation JS

A small animation library inspired by this tweet.

Installation

Just paste npm install text-animation-js in the console.

How to use it

Just import the component and pass a HTML element to it.

import Animation from "text-animation-js";

const animation = new Animation(document.querySelector("p"));

Call new Animation() will return an animation instance.

Also you need to import the css styles:

import "text-animation-js/styles.css";

Animation

Configuration

Animation accepts two parameters, a HTML element and callback that will be called on animation end.

Methods

Each Animation instance has three methods play, pause, and reset:

Play

Call animation.play() will start the animation, it returns the animation instance.

document.querySelector("button").addEventListener("click", () => {
  animation.play();
});

This will start the animation when the button is clicked.

Pause

Call animation.pause() will pause the animation, it returns the animation instance.

document.querySelector("button").addEventListener("click", () => {
  animation.pause();
});

This will pause the animation when the button is clicked.

Reset

Call animation.reset() will reset the animation, it returns the animation instance.

document.querySelector("button").addEventListener("click", () => {
  animation.reset();
});

This will reset the animation when the button is clicked.

Controlling multiple animations

This is a helper to control multiple animations with one call.

Configuration

AnimationList accepts one parameter, an Animation array, this will be the animations to control.

const animations = [
  new Animation(element1),
  new Animation(element2),
  new Animation(element3),
];

const animationList = new AnimationList(animations);

Methods

Each AnimationList instance has three methods play, pause, and reset:

Play

Call animationList.play() will start the animations, it will wait for each animation to finish before starting the next one.

document.querySelector("button").addEventListener("click", () => {
  animationList.play();
});

Pause

Call animationList.pause() will pause all the animations.

document.querySelector("button").addEventListener("click", () => {
  animationList.pause();
});

Reset

Call animationList.reset() will reset all the animations.

document.querySelector("button").addEventListener("click", () => {
  animationList.reset();
});

Demos

You can find some demos here.

TODO

  • [ ] animaciones personalizadas
  • [ ] unit testing?

Issues

  • [ ] callback hell, Animation.play solo agrega callbacks, hay que limpiarlos después de lanzárlos
  • [ ] AnimationList pause no funciona justo al final de la transición