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-infinite-text-reel

v1.0.4

Published

customizable infinite text reel using gsap and react

Downloads

18

Readme

react-infinite-text-reel

The Last Reel, Ever

🎉 Version 1.0.3.x is live ! 🎉

Installation

NPM

npm install --save react-infinite-text-reel

Yarn

yarn add react-infinite-text-reel

Example GIf

Example app (check out on this link)

https://react-infinite-text-reel.netlify.app/

You can look for an example here Make sure to install the latest version of the package before testing it out.


Parameters:

| Name | Required | Type | Description | | ---------------------- | -------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------- | | reelTexts | Yes | string[] | An array of string for multiple reels altogether. | | duration | Yes | number[] | duration will determine the speed of reel. The smaller the faster it is.(keep it around 30 for better experience) | | directionArr | Yes | number[] | Determines the direction for each text reel. | | initialXOffsetFunction | no | function | This function helps in tweeking around the initialXOffset of the reel.(look for default parameter for more info.) | | strokeFunction | no | function | it determines if you want to make every second text stoke or depends on you | | affectOnScrollArr | Yes | boolean[] | Increases velocity of the reel based on scrolling speed(works best with smooth scrolling). | | containerRotation | no | number | This accepts degrees by which the whole container will be rotated - It looks cool. Make sure to keep it from (-10 to 10) or depends on you. | | velocityOnScroll | no | number | The larger the value the slower it will be (default-100). | | smoothScrolling | no | any | Discussed about it ->below. |

Default Parameters:

  • containerRotation = 0
  • velocityOnScroll = 100
  • initialXOffsetFunction
    (index: number) => (-index % 2) * 250,
    (index) here represent every text reel starting from 0
  • strokeFunction
    (itemIndex: number,rowIndex:number) => !(itemIndex % 2),

Usage

Note: Make sure to include the css from node_modules Your can change css to suite your need.

import InfiniteTextReel from "react-infinite-text-reel";
import "react-infinite-text-reel/lib/css/text-reel.css";

<InfiniteTextReel
  reelTexts={["Vineet"]}
  affectOnScrollArr={[true]}
  directionArr={[1]}
  duration={[30]}
/>;


SmoothScrolling

If you are using any external library for smooth scrolling You need to pass your custom scrolling function as a parameter to smoothScrolling

An Example is demonstrated below :

import ScrollBar from "smooth-scrollbar";
import { ScrollTrigger } from "gsap/ScrollTrigger";
export default () => {
  let bodyScrollBar;

  bodyScrollBar = ScrollBar.init(document.querySelector("#viewport"), {
    damping: 0.07,
  });

  bodyScrollBar.track.xAxis.element.remove();

  ScrollTrigger.scrollerProxy(document.body, {
    scrollTop(value) {
      if (arguments.length) {
        bodyScrollBar.scrollTop = value; // setter
      }
      return bodyScrollBar.scrollTop; // getter
    },

    getBoundingClientRect() {
      return {
        top: 0,
        left: 0,
        width: window.innerWidth,
        height: window.innerHeight,
      };
    },
  });
  // when the smooth scroller updates, tell ScrollTrigger to update() too:
  bodyScrollBar.addListener(ScrollTrigger.update);
};

Now pass this function as a smoothScrolling parameter and everthing would work fine. ✨ This can only be understood if you have some knowledge of integrating smooth scrolling with gsap.

If you liked 🤩 it. Make sure to leave a ⭐ on my github Repo