0.0.3 • Published 4 years ago
progressive-string-morpher v0.0.3
String Morphing.
This was initially used to animate the transition steps between anagrams, however works with other strings as well. It does a bubble sort to shuffle the characters around to match the target string. It also does some pre and post processing to support missing characters and casing inconsistencies.
This can then be used for animated text and other uses. Please share your usages with @aggronerd on Twitter. '
Examples
const {morph} = require('progressive-string-morpher');
const transition = morph("More", "Rome!");
do {
console.log(transition.getCurrentString());
} while (!transition.next());
Will output:
More
more
omre
orme
rome
rome!
Rome!
Installation
Using Yarn:
yarn add progressive-string-morpher
Using NPM:
npm install progressive-string-morpher
Development
Requirements
- Node >= 10.15
Unit Tests
npm run test
Compiling
The following will transpile the Typescript into the packaged Javascript.
npm run build
Integration Test
This requires the Javascript to be compiled and in the dist folder prior to running.
npm run integration-test
Contributing
PRs welcome if you have any changes in mind.