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

@viewtech-labs/revealing-text

v1.0.7

Published

react component to show text at various increments while scrolling

Downloads

14

Readme

react-revealing-text

npm version

A react text container component that reveals letter by letter as you scroll through the page. I originally saw this in a youtube video but wanted to recreate this effect regardless of the content.

Installation

Install using npm:

npm install --save @viewtech-labs/revealing-text

Install using yarn:

yarn add @viewtech-labs/revealing-text

Usage

// Import the library
import { RevealingText } from "@viewtech-labs/revealing-text";

// return it from your components
return (
  <RevealingText
    className="[&>span]:text-3xl [&>span]:text-gray-50 [&>span]:font-bold"
    startZoneY={1000}
    endZoneY={300}
    opacitySharpness={16}
    minOpacity={0.1}
    text="Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eius,
      eveniet voluptate! Quia at atque voluptas quis distinctio ut
      labore! Error ad sapiente voluptatem fuga rerum tenetur quod.
      Sit, modi minima. Lorem ipsum dolor sit amet, consectetur
      adipisicing elit. Eius, eveniet voluptate! Quia at atque
      voluptas quis distinctio ut labore! Error ad sapiente voluptatem
      fuga rerum tenetur quod. Sit, modi minima."
  />
);

See this example working.

API

Below we have all the props that we can use with the <RevealingText> component. There are also some methods that can be used imperatively.

| Name | Type | Default | Description | | -------------------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | text | number | N\A | Represents the text to be implemented into component, based on the length the reveal will change rate. | | startZoneY | number | 1000 | Subtracting from the offsetY of the component made, startZoneY represents the starting zone line triggering the reveal. | | endZoneY | number | 300 | Subtracting from the offsetY of the component made, startEndY represents the end zone line where all letters are shown. | | opacitySharpness | number | 16 | Reprents the sharpness of the reveal curve using (1/x^y) y being 16 by default, use a lesser for the curve to be a more rounded curve resulting in more letters being revealed. | | minOpacity | number | 0.1 | Represents the min opacity for revealing text, allowing for a shadow to be shown first | | className | number | N/A | Value forwarded to the className of the div container of the letters |

Usage with TypeScript

Interface for Props

interface RevealingTextProps {
  text: string;
  startZoneY: number;
  endZoneY: number;
  opacitySharpness?: number;
  minOpacity: number;
  className: string;
}