0.4.0 • Published 5 years ago

react-animate-text v0.4.0

Weekly downloads
17
License
MIT
Repository
github
Last release
5 years ago

react-animate-text

React tool for common text animations written in typescript

NPM JavaScript Style Guide

Install

You need to install this along with rxjs as it is peer dependency.

npm install react-animate-text rxjs
yarn add react-animate-text rxjs

Usage

To animate text simply wrap it in react-animate-text component

import TextAnimation from 'react-animate-text';

<TextAnimation>Hello world</TextAnimation>;

simple as that! try it yourself

Actually it does not need to be text, you can pass any react composition, react-animate-text will animate text in order of they apperance. Styles and other attributes will be preserved

import TextAnimation from 'react-animate-text';

<TextAnimation>
  <main>
    <h1>This is header</h1>
    <span style={{ color: 'red' }}>Exciting styled text</span>
    <div>
      <div>
        <div>
          <span>Man it is nested!</span>
        </div>
      </div>
    </div>
  </main>
</TextAnimation>;

try it yourself

Check the full API below

API

Proptypedefault valuerequireddescription
animation"type" | "delete" | "backspace""type"noApplied animation for texts"type" - animates typing texts"delete" - animates deleting texts"backspace" - animates backspacing text
caretReact.NodenonenoReactNode used as caret.Cared is displayed at the begining of delete animation and at the end of type and backspace animations.
charIntervalnumber200noInterval between subsequent animation frames (typing/deleting/backspacing subsequent characters) in miliseconds
childrenReact.NodenoneyesString or any react composition.All included texts will be animated in order of their appearance.
onNextCharstring => anynonenoFunction called every subsequent animation frame. It receives current displayed text as argument.

License

MIT © prztrz

0.4.0

5 years ago

0.3.2

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago