"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! 😀
http://dkozar.github.io/react-wrappy-text/
// 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);
npm install react-wrappy-text --save
This will install the package into the node_modules folder of your project.
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.
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.
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
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.
🚀 React Transform Boilerplate for the workflow.