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

simply-animate

v0.0.7

Published

A simple multi-step animation utility with all kinds of hooks for the simpliest to the most complex needs in a small footprint

Readme

Simply Animate

A small utility function for handling multi-step animations. Can handle everything from the most simple use cases to much more complex ones with an extremely robust hook system. All without sacrificing speed.

Currently built for use with HTMLElements, but can also just be used purely for it's hooks, making it easy to use with libraries like React, Redux, Vue, and so on.

Getting Started

TODO add the install instructions and such

Getting started with the animationSeries function is fairly simple. All you have to do is call the function, and pass step objects to it.

The easiest way to use this function is to pass an HTMLElement to it, define durations and step names for each step, and use CSS to apply whatever animations, transitions, or styles needed for each step.

import animationSeries from 'simply-animate';

// Basic Example
animationSeries({
  element: document.getElementById('exampleThingToAnimate'),
  seriesClassName: 'series-example',
  steps: [
    {
      name: 'action-1',
      duration: 300
    },
    {
      name: 'action-2',
      duration: 400
    }
  ]
});

In this example, a few classes will be added to the element passed. An "in progress" class, as well as step classes. The step classes, however, are added and removed as the series executes each step.

The "in progress" class for this example: .animation__series-example__in-progress

Step 1's class: .animation__series-example__action-1

Step 2's class: .animation__series-example__action-2

When the series is finished, all remaining classes added will be removed.

TypeScript

To get access to the types and interfaces included in this package:

// TODO Add Example

API

The animationSeries function takes an object as its argument.

| Props | Type | Required | Description | | ----- | ---- | :------: | ----------- | | element | HTMLElement | | HTMLElement object that the animation classes will be applied to. | | namespaceClass | string | | The first namespace in the CSS class name. This is meant to allow for replacing the globally used namespace at a function by function level. | | seriesClassName | string | ✅ | The function level namespace for the animation. | | hooks | object | | See function Hooks for more info. | | steps | array | ✅ | An array of Step objects. At least one must be passed. |

Step Object

| Props | Type | Required | Description | | ----- | ---- | :------: | ----------- | | name | string | ✅ | Name of the step to be used in the CSS class name. | | duration | number | ✅ | duration of the step in milliseconds. | | hooks | object | | Hooks specific to the animation step. See Step Hooks below. |

Hooks

Series Hooks (object)

These hooks apply to the entire series. Use Step Hooks to hook into individual steps in the animation series.

| Props | Type | Required | Description | | ----- | ---- | :------: | ----------- | | before | function | | Fires before the first animation frame is requested. | | beforeEachStep | function | | Fires at the beginning of each step, before the css classes are updated. | | duringEachStep | function | | Fires after css classes are updated for each step. | | beforeEachFrame | function | | Fires before every frame. | | afterEachFrame | function | | Fires after every frame, but before afterEachStep hook is fired when the hooks share a frame. | | afterEachStep | function | | Fires at the end of each step, at the same time the step index is being incremented. | | after | function | | Fires at the end of all the steps, in place of requesting another animation frame. |

Step Hooks (object)

| Props | Type | Required | Description | | ----- | ---- | :------: | ----------- | | before | function | | Fires at the beginning of the step, before classes are updated, but after beforeEachFrame when the hooks share a frame. | | during | function | | Fires after classes have been updated, but after the duringEachStep series hook. | | beforeEachFrame | function | | Fires at the beginning of each frame but after the beforeEachFrame series hook. | | afterEachFrame | function | | Fires at the end of each frame, after all step hooks that share the frame. | | after | function | | Fires at the end of each step, but after afterEachStep series hook. |

Hook Function Param

All hook functions are passed an object as a single param.

| Props | Type | Description | | ----- | ---- | ----------- | | element | HTMLElement | Element passed to the AnimationSeries function. This will only be present if an element was passed to the animationSeries function. | | progress | object | Object containing different progresses of the animation. | | progress.series | number | Progress of entire animation series represented as a number between 0 and 1. | | progress.step | number | Progress of the active step represented as a number between 0 and 1. |