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

basic-scroll-animations

v1.1.1

Published

An easy to use library to help you create basic scrolling animations.

Readme

Basic Scroll Animations

This is a small and simple library for creating scroll animations, inspired by ScrollMagic.

Installation

npm install basic-scroll-animations

Usage

import { updateOnScroll,triggerOnScroll,elementBottom } from 'basic-scroll-animations';

updateOnScroll('.myElement(s)')
    .from(0,{opacity:0})
    .to(1,{opacity:1})
    .using({easing:'easeInOut'});

triggerOnScroll('.myElement(s)')
    .after(elementBottom('.myElement'))
    .applyClass('myClass');

API

Entry point: updateOnScroll(selector)

Registers selected element(s) to be updated on scroll using the returned Animation object.

| Param | Type | Description | | --- | --- | --- | |selector | String | CSS selector for the element(s) to be updated on scroll. |

Returns: Animation

Entry point: triggerOnScroll(selector)

Registers selected element(s) to be applied an effect on scroll using the returned Trigger object.

| Param | Type | Description | | --- | --- | --- | |selector | String | CSS selector for the element(s) to be updated on scroll. |

Returns: Trigger

Position calculation functions:

elementTop(selector) Returns the top position of the element(s) relative to the document in scroll percentage.

elementBottom(selector) Returns the bottom position of the element(s) relative to the document in scroll percentage.

elementHeight(selector) Returns the height of the element(s) in scroll percentage.

Note: if the selector matches multiple elements, the functions will return the data of the first element.

It is recommended to use these functions to calculate the position of the element(s) on scroll. Example:

const start = elementBottom('.myElement(s)');
const finish = elementBottom('.myElement(s)') + elementHeight('.myElement(s)');

updateOnScroll('.myElement(s)')
    .from(start,{opacity:0})
    .to(finish,{opacity:1});

Animation

The Animation object is returned by the entry point functions and is used to define the animation for the element(s) registered with it. The from and to functions are used to define the 2 styles that will be used to interpolate the element(s) style on scroll. !Should only be initalized by an entry function.

from Sets the initial style of the element(s).

| Param | Type | Description | | --- | --- | --- | |percent | Number | The percentage (between 0 and 1) at which the element(s) should start being animated. | |style | Style | The starting style to be applied to the element(s). |

Returns: Animation

to Sets the final style of the element(s).

| Param | Type | Description | | --- | --- | --- | |percent | Number | The percentage (between 0 and 1) at which the element(s) should be fully animated. | |style | Style | The final style to be applied to the element(s). |

Returns: Animation

using Sets the interpolation function to be used to interpolate the element(s) style on scroll.

| Param | Type | Description | | --- | --- | --- | | options | Options | The options to be used to interpolate the element(s) style on scroll. |

Returns: Animation

Style

The Style object is used to define the style of the element(s) to be animated. The Style object currently supports the following properties:

| Property | Type | Values | Description | | --- | --- | --- | --- | | opacity | Number | 0-1 | The opacity of the element(s). | | translateX | Number | any | The X translation of the element(s). | | translateY | Number | any | The Y translation of the element(s). | | scaleX | Number | any | The X scale of the element(s). | | scaleY | Number | any | The Y scale of the element(s). |

Options

The Options object is used to define the behaviour of the animation. The Options object currently supports the following properties:

| Property | Type | Values | Description | | --- | --- | --- | --- | | easing | String | lineareaseIneaseOuteaseInOut | The easing function to be used to interpolate the element(s) style on scroll. |

Trigger

The Trigger object is returned by an entry function and is used to apply effects to the selected elements at a specific scroll position. !Should only be initalized by an entry function.

after Applies the given style to the selected elements after the given scroll position.

| Param | Type | Description | | --- | --- | --- | |percent | Number | The percentage (between 0 and 1) at which the style should be applied to the element(s). |

Returns: Trigger

before Applies the given style to the selected elements before the given scroll position.

| Param | Type | Description | | --- | --- | --- | |percent | Number | The percentage (between 0 and 1) at which the style should be applied to the element(s). |

Returns: Trigger

applyClass

| Param | Type | Description | | --- | --- | --- | | className | String | The class name to be applied to the element(s). |

Returns: Trigger

removeClass

| Param | Type | Description | | --- | --- | --- | | className | String | The class name to be removed from the element(s). |

Returns: Trigger