react-wrappy-text v1.1.2
React Wrappy Text
"Unwrapping" text component for React.
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! 😀
:tv: Demo
http://dkozar.github.io/react-wrappy-text/
:zap: 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);:truck: Installation
Use it as the NPM package:
npm install react-wrappy-text --saveThis 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 installnpm install will install all the dependencies (and their dependencies) into the node_modules folder.
Then, you should run one of the builds.
:factory: Builds
:rocket: Hot-loader development build
npm start
open http://localhost:3000This 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.
:helicopter: Demo build
npm run demoThis should build the minified demo folder (it's how the demo is built).
npm run debugThis 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:steam_locomotive: Additional builds
npm run buildRuns Babel on source files (converting ES6 and React to JS) and puts them into the build folder.
npm run distBuilds the webpackUniversalModuleDefinition and puts it into the dist folder.
npm run allRuns all the builds: build + dist + demo.
:thumbsup: Thanks to:
:rocket: React Transform Boilerplate for the workflow.



