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-easing-scroll

v1.1.0

Published

🚀 React component that eliminates the need for jQuery easing, providing seamless and smooth scroll animations with over 30 Ease functions 🌟 for in-page navigation links⚡

Downloads

19

Readme

npm npm Package quality NPM

Install

$ npm install react-easing-scroll

or

$ yarn add react-easing-scroll

Run

$ npm install
$ npm test
$ npm start

or

$ yarn
$ yarn test
$ yarn start

Examples

Checkout the Live examples

Basic

Code

Usage

import React from 'react';
import useEasingScroll from "react-easing-scroll";
function App(){

    useEasingScroll('easeOutExpo', 1500, 'easeScrollMe');
    //Calling the hook useEasingScroll, with the easing effect 'easeOutExpo' to be applied
    //when it is scrolling to the target, the scrolling duration must be 1500 milliseconds,
    //and the scrolling will only activate when the target is linked to a hyperlink which
    //has className - 'easeScrollMe'.

  // Rendering the component's JSX.
  return (
  <div>
    {/* Hyperlinks that scroll towards their target element instead of navigating 
    through the default fragment identifier navigation using <a> tag, because of
    the className "easeScrollMe" that is passed to useEasingScroll as a parameter*/}

    <a href="#target3" className="easeScrollMe"><button>TRES</button></a>

    <a href="#target2" className="easeScrollMe"><button>DUO</button></a>

    <a href="#target1" className="easeScrollMe"><button>UNUS</button></a>

    {/* Hyperlinks that DON'T scroll towards their target element and instead 
    navigate using the default fragment identifier navigation using <a> tag,
    because of the absence of the className "easeScrollMe" that is passed to 
    useEasingScroll as a parameter */}

    <a href="#target3"><button>TRES</button></a>

    <a href="#target2"><button>DUO</button></a>

    <a href="#target1"><button>UNUS</button></a>

    {/* Sections that act as scroll targets */}
    <section id="target1">
        Hello World 1!
    </section>

    <section id="target2">
        Hello World 2!
    </section>

    <section id="target3">
        Hello World 3!
    </section>

  </div>
);

};

export default App;

Parameters

Full example

import useEasingScroll from "react-easing-scroll";

function App(){
    useEasingScroll('easeInBack', 1500, 'exampleClassScroll', 4.2);
    return(
        <div>
            <a href="#example1" className="exampleClassScroll">Scroll!</a>
            <div id="example1">
                Hello World!
            </div>
        </div>
    );
}

List of currently available animations:

linear
	- Constant speed, and no acceleration or deceleration.

easeInSine 
	- Starts with zero initial speed and features gradual acceleration.

easeOutSine 
	- Starts with high initial speed and features gradual deceleration.

easeInOutSine 
	- Starts with zero initial and final speeds, with smooth acceleration and deceleration.

easeInCubic 
	- Starts with zero initial speed and exhibits gentle acceleration.

easeOutCubic 
	- Starts with high initial speed and demonstrates gentle deceleration.

easeInOutCubic 
	- Starts with zero initial and final speeds, with gentle acceleration and deceleration.

easeInQuint 
	- Starts with zero initial speed and displays gradual acceleration.

easeOutQuint 
	- Starts with high initial speed and shows gradual deceleration.

easeInOutQuint 
	- Starts with zero initial and final speeds, with gradual acceleration and deceleration.

easeInCirc 
	- Starts with zero initial speed, with a slight increase in acceleration.

easeOutCirc 
	- Starts with high initial speed and rapidly decreases acceleration.

easeInOutCirc 
	- Starts with zero initial and final speeds, with a gradual change in acceleration.

easeInElastic 
	- Varies, typically starts with zero initial speed and features a bouncy acceleration.

easeOutElastic 
	- Varies, typically ends with zero initial speed and exhibits bouncy deceleration.

easeInOutElastic 
	- Varies, starts and ends with zero speed, with oscillatory acceleration and deceleration.

easeInQuad 
	- Starts with zero initial speed and demonstrates moderate acceleration.

easeOutQuad 
	- Starts with high initial speed and exhibits moderate deceleration.

easeInOutQuad 
	- Starts with zero initial and final speeds, with moderate acceleration	and deceleration.

easeInQuart 
	- Starts with zero initial speed and displays strong acceleration.

easeOutQuart 
	- Starts with high initial speed and shows strong deceleration.

easeInOutQuart 
	- Starts with zero initial and final speeds, with strong acceleration and deceleration.

easeInExpo 
	- Starts with extremely low initial speed and rapidly increases acceleration.

easeOutExpo 
	- Starts with high initial speed and rapidly decreases acceleration.

easeInOutExpo 
	- Starts with extremely low initial and final speeds, with rapid acceleration and deceleration.

easeInBack 
	- Starts with zero initial speed and features gradual acceleration with a slight overshoot.

easeOutBack 
	- Starts with high initial speed and exhibits gradual deceleration with a slight overshoot.

easeInOutBack 
	- Starts with zero initial and final speeds, with gradual change in acceleration and a slight overshoot.

easeInBounce 
	- Starts with zero initial speed and bouncy motion at the beginning.

easeOutBounce 
	- Starts with high initial speed and exhibits bouncy deceleration at the end.

easeInOutBounce 
	- Starts with zero initial and final speeds, with bouncy motion at the start and end.

All the easing effects except linear can be found at easings.net