react-wrappy-text

1.1.2 • Public • Published

NPM

NPM

React Wrappy Text

"Unwrapping" text component for React.

Wrappy Text!

Ported my old eDriven.Gui component, originally written in C# (for Unity3d game engine).

Just as a proof of concept, and because I like the effect.

The effect is inspired by the work of great Flash guru Elvis Mehmedović. Elvis, get back to programming! 😀

📺 Demo

http://dkozar.github.io/react-wrappy-text/

⚡️ Usage

// ES6
import React, { Component } from 'react';
import { render } from 'react-dom';
import WrappyText from 'react-wrappy-text';
 
export class App extends Component {
 
    render() {
        return (
            <div>
                <WrappyText>This is the default wrappy text.</WrappyText>
 
                <WrappyText
                    replacements='$$$$$$$$$$$$$$$$$$$\\\\___+-_'
                    fps={40}
                    factor={0.8}
                    onProgress={this.onProgress}>
                    This is the configured wrappy text.
                </WrappyText>
            </div>
        );
    }
    
    onProgress(info) {
        var progress = info.done / info.total;
        console.log('Progress: ' + 100 * progress + '%');
    }
}
 
render(<App />, document.body);

🚚 Installation

Use it as the NPM package:

npm install react-wrappy-text --save

This will install the package into the node_modules folder of your project.

Or, download the project source:

git clone https://github.com/dkozar/react-wrappy-text.git
cd react-wrappy-text
npm install

npm install will install all the dependencies (and their dependencies) into the node_modules folder.

Then, you should run one of the builds.

🏭 Builds

🚀 Hot-loader development build

npm start
open http://localhost:3000

This will give you the build that will partially update the browser via webpack whenever you save the edited source file.

Additionally, it will keep the React component state intact.

For more info on React hot-loader, take a look into this fantastic video.

🚁 Demo build

npm run demo

This should build the minified demo folder (it's how the demo is built).

npm run debug

This should build the non-minified demo folder (for easier debugging).

You could install the http-server for running demo builds in the browser:

npm install http-server
http-server

🚂 Additional builds

npm run build

Runs Babel on source files (converting ES6 and React to JS) and puts them into the build folder.

npm run dist

Builds the webpackUniversalModuleDefinition and puts it into the dist folder.

npm run all

Runs all the builds: build + dist + demo.

👍 Thanks to:

🚀 React Transform Boilerplate for the workflow.

Downloads!

Package Sidebar

Install

npm i react-wrappy-text

Weekly Downloads

0

Version

1.1.2

License

MIT

Unpacked Size

92.7 kB

Total Files

33

Last publish

Collaborators

  • dkozar