A small react library for animating the revealing of text.
The demo page was built with React Storybook.
npm install --save react-reveal-text
This component has many props that you can manipulate; below is a list of all of them.
Note that the component only re-renders when the
show property has been changed.
You can set the text either by passing in text as children or by using the text property.
This prop allows you to control what state the component is in. It allows you to hide or reveal the text.
This prop allows you to set the className for the div surrounding the text.
This prop allows you to pass in styles for the div surrounding the text.
Each letter has its own randomly generated delay before its transition begins.
transitionTime (integer) [default: 1300]
The time it takes for each letter's transition.
timingFunction (string) [default: 'linear']
The CSS transition-timing-function property. On this page, you are given a dropdown selection, but in practice (and in the sandbox), you can enter in any valid string.
delayMin (integer) [default: 200]
The minimum allowable delay before the transition for a letter is to begin.
delayMax (integer) [default: 1200]
The maximum allowable delay before the transition for a letter is to begin.
threshold (float) [default: 0.2]
The difference between the random numbers generated for each letter compared to the previous letter. Setting this higher will force the delays to be very different between each letter, spreading out the effect. Setting this lower will allow delays to be similar between letters, sometimes creating a chunking effect.
This project was built using my two other tools: React Build Lib and React Build Dist. These tools are still very early in development, so if you are building these libraries, you may encounter some bugs. PRs and issues are welcomed and encouraged! Should probably add some testing too.