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-text-transition-colors

v3.0.3

Published

A React plugin that animates your text when it changes.

Downloads

13

Readme

React-Text-transition-color

Animate your text changes

text-transition

Edit r03264p26n

Installation

npm install -S react-text-transition-color

Using the demo

npm run dev

How to use

Example

import React                       from "react";
import TextTransition, { presets } from "react-text-transition";

const TEXTS = [
  "Forest",
  "Building",
  "Tree",
  "Color"
];

const App = () => {
  const [index, setIndex] = React.useState(0);

  React.useEffect(() => {
    const intervalId = setInterval(() =>
      setIndex(index => index + 1),
      3000 // every 3 seconds
    );
    return () => clearTimeout(intervalId);
  }, []);

  return (
    <h1>
      <TextTransition springConfig={presets.wobbly} colors={['#efdd43', '#57c518']}>
        {TEXTS[index % TEXTS.length]}
      </TextTransition>
    </h1>
  );
};

Props

| Prop | Type | Default | Definition | | --- | --- | --- | --- | | text | String | REQUIRED | The text you want to show. | | direction | String (enum) | 0 | Used to determine the direction of the transition "up" or "down" (Must be an all-lowercase string). | | inline | Boolean | false | Makes the wrapper inline (will auto resize based on contents). | | delay | Number | 0 | Delay the transition of the text (in milliseconds). | | springConfig | Object | { mass: 1, tension: 170, friction: 26 } | react-spring's spring configuration. | | className | String | "" | Any css classes that you might want to send to the wrapper. | | style | React.CSSProperties | {} | Any styles that you might want to send to the wrapper. | | children | React.ReactNode | REQUIRED | The react node to be animated |


Detailed Props

inline Boolean

Will simply make the wrapper an inline element and animate its width based on currently showing text, this is useful if you want to show some other static text on the same line.

delay Number

The amount of miliseconds to wait before transitioning.

spring Object

react-spring's Spring configuration (Refer to the configs section) react-spring's spring presets are exposed as presets.

  import TextTransition, { presets } from "react-text-transition";

  // in your render method
  <TextTransition springConfig={presets.wobbly}>
    {this.state.text}
  </TextTransition>

There're 4 presets

  • default The default.
  • gentle
  • wobbly
  • stiff
  • slow
  • molasses

className String

Any css classes that you might want to provide to the wrapper.

style React.CSSProperties

Any css styles that you might want to provide to the wrapper.

NOTE

Feel free to ask any questions about using this component. This plugin requires react +16.8