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

react-scrolling

v1.0.2

Published

This is react component library that is heavily influenced by animate on scroll library.

Downloads

11

Readme

React Scrolling Library

Overview

Welcome to React Scrolling Library! This library is a collection of powerful and customizable React components that make it easy to build scrolling animation for your component. This library is heavily influenced by aos(animate on scroll) library. You can animate component when it's visible in viewport. This library uses the IntersectionObserver api to do so.

Table of Contents

Installation

To install React Awesome Library, you can use npm or yarn:

npm install react-scrolling
# or
yarn add react-scrolling

Examples

Usage

ScrollAnimate usage:

   <ScrollAnimate 
      animate={['opacity', 'moveUp']} 
      transform={{opacityFrom:0.5, translateBy:'100px'}} 
      once={false}>
          // your component
         <div color='blue' text="fade-up">Fade up</div>
   </ScrollAnimate>

Scrolling usage:

   <Scrolling animate='fade-left' 
      transform={{translateBy : 100}} 
      transition={{easing: 'ease-in', delay: 10}} >
      // your component
      <div color='blue' text="fade-up">Fade up</div>
   </Scrolling>

Components

This library includes two components that you can use to wrap your component that needs animation when visible in viewport.

  1. Scrolling : This component allows us to add predetermined animation based on scroll position.
  2. Scroll Animate : This component allows us to add predetermined animation based on element position in viewport.

Props

ScrollAnimate props

| Props | Type | Default Value | Description | | -------- | -------- | -------- | --------- | | animate | DefaultStyles or AcceptedStyle[] | fade | You can choose various predefined animate style | | once | boolean | true | If true, the animation will be executed only once. | | offset | string | 0px | This is similar to root margin in intersection observer. Check MDN for more detail.| | trigger | number or number[] | 1 | 1 trigger animation when every pixel of the component is seen, 0 trigger animation when even 1 pixel is shown. This is similar to threshold in intersection observer. Check MDN for more detail.| | transition | ITransition | {duration : 500,easing : 'ease-in-out',delay : 300,} | You can manipulate the duration, easing function and delay of animation.| | transform | ITransform | {translateBy : '100px',opacityFrom : 0,scaleUpBy : 1.2,scaleDownBy : 0.6} | You can edit the transform property as per your preference. |

Scrolling props

| Props | Type | Default Value | Description | | -------- | -------- | -------- | --------- | | animate | DefaultStyles or AcceptedStyle[] | fade | You can choose various predefined animate style | | transition | ITransition | {duration : 30,delay : 0,easing : 'ease'} | You can manipulate the duration, easing function and delay of animation.| | transform | ITransform | {translateBy : 500,translateUnit : 'px',scaleUpBy : 1.6,scaleDownBy : 0.4,} | You can edit the transform property as per your preference. | | animateWhen | TAnimateWhen | 'enter' | You can specify when to trigger animation.

Types

  • DefaultStyles : It accepts string value that are predefined to represent various animation styles. Following are the values you can pass:

    • "fade"
    • "fade-up"
    • "fade-down"
    • "fade-left"
    • "fade-right"
    • "zoom-in"
    • "zoom-in-up"
    • "zoom-in-down"
    • "zoom-in-left"
    • "zoom-in-right"
    • "zoom-out"
    • "zoom-out-up"
    • "zoom-out-down"
    • "zoom-out-left"
    • "zoom-out-right"
    • "slide-up"
    • "slide-down"
    • "slide-left"
    • "slide-right"
  • AcceptedStyle[] : It accepts array of string that are predefined. Following are the values that you can pass in an arrary

    • 'opacity'
    • 'moveRight'
    • 'moveLeft'
    • 'moveDown'
    • 'moveUp'
    • 'scaleUp'
    • 'scaleDown'
  • ITransition : It accepts object with following key. Every key is optional here.

    • duration: It accepts number that represents the duration of animation.
    • easing: It accepts string that represents the timing function of animation.
    • delay: It accepts number that represents the delay of animation.
  • TAnimateWhen : It accepts three values which represents when the start the animation.

    • exit : when component is going out of viewport
    • enter : when component is going in the viewport
    • both : in both above case

ITransform for Scrolling component:

  • ITransform : It accepts object with following key. Every key is optional here.
    • translateBy : It accepts string which represents how much to move your component. ex.: '200px'.
    • opacityFrom : It accepts number which represents the starting opacity value.
    • scaleUpBy : It accepts number which represents how much to scale up your component.
    • scaleDownBy : It accepts number which represents how much to scale down your component.;

ITransform for ScrollAnimate component:

  • ITransform : It accepts object with following key. Every key is optional here.
    • translateBy : It accepts number which represents how much to move your component.
    • translateUnit : It accepts string which represents the unit e.g: px or em for translate value mentioned above.
    • scaleUpBy : It accepts number which represents how much to scale up your component.
    • scaleDownBy : It accepts number which represents how much to scale down your component.;

License

React Scrolling Library is licensed under the MIT License - see the LICENSE file for details. Feel free to use, modify, and distribute the library according to the terms of the license.

Happy coding with React Scrolling Library! 🚀