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

scroll-bound-animation

v1.1.6

Published

Change CSS properties of any HTML (SVG too) element and bind it with the scrolled position of the window.

Downloads

5

Readme

Scroll Bound Animation

"Buy Me A Coffee"

Change CSS properties of any HTML (SVG too) element and bind it with the scrolled position of the window. 🥳🤩

This library is fairly new 🐣 so I encourge people to Report an issue in case you find something that doesn't work for you. We'll fix it instantly ⚡️⚡️

Installation

npm install scroll-bound-animation --save

Example

Usage

Declare a new instance of class ScrollBound like: 👇

  import ScrollBound from "scroll-bound-animation";
  var data = require("./animation.json");
  new ScrollBound(data);

Data is a JSON file of the following format 👇

  {
    "<query-selector-for-element>": {
      "<CSS-property>": [
        {
          "animationHeightOffset": "<float><required>",
          "startAnimationValue": "<string><required>",
          "endAnimationValue": "<string><required>",
          "animationSpeed": "<integer><optional/default:1>"
        }
      ]
    }
  }

What does these mean?

  • : string: Type the query selector as you'd enter for document.querySelectorAll("")(This is what's used behind the scenes 🥸). Eg: ".list > span", "#someId", "p". This returns list of all the elements that gets selected and applies animation on all of it. Use it carefully 🧐. Best Practice is to only give IDs to your elements 😎.
  • : string: This can be any CSS property that you want to animate and takes an integer value. For some nested properties like transform or filter, You need to add the nested property separted with a space. THe takes an array so that you can apply same property at multiple heights. Eg: "transform scaleX" or "opacity" or "left".
  • animationHeightOffset: float: At scale of 100vh (100vh = 1 window height). Specifies height at which animation starts. Eg: 1, 1.5, 2.
  • startAnimationValue: string: Starting point from which you want to vary the said CSS property. Eg: "0", "400px", "3rem", "-10%" etc.
  • endAnimationValue: string: Ending point to which you want to vary the said CSS property. Eg: "1", "700px", "7rem", "100%" etc.
  • animationSpeed: integer: Speed at which you want to complete the animation. Eg: 2 means animation will complete at twice the speed.

Example

  {
    "#right_page > .shp1": {
      "transform rotate": {
        "animationHeightOffset": 11.5,
        "startAnimationValue": "-90deg",
        "endAnimationValue": "1.59deg",
        "animationSpeed": 5.67
      }
    }
  }

Although this is the most complex supported query I could think of,🤕 I encourage you guys to be creative 😛

Supported CSS Properties

This list is always under development 🤖. We're adding more and more properties as it is requested. You can't find your property listed here? Report an issue 🙏

  • Numerical units like "0", "1", "-200"
  • Distance units like "1rem", "50%", "200px", "-300%"
  • Nested Units like "transform: scaleY(1.5) scaleX(1.2)"