1.0.3 • Published 3 years ago
txt-shuffle v1.0.3
txt-shuffle
Customisable text shuffling animations.
Install
npm install txt-shuffleExample
const { shuffle } = require('txt-shuffle');
shuffle({ text: 'Hello world', fps: 5, onUpdate: (output) => {
console.log(output);
} });Output:
kE}3 7
Hep|> |dJ
Hello UAo_
Hello worlz
Hello worldDemo
API
shuffle(options)
Starts a text shuffle animation in two tiers. First shuffling through random characters and then resolving into the target text.
options-text(default'') text string -duration(default1) duration of shuffle/resolve animation in seconds -delay(default0) delay to start shuffling -delayResolve(default0.2) delay to start resolving -fps(default60) framerate -glyphs(see below) glyphs to use in the shuffle animation -animation(defaultshow) possible values:show,hide,stay-direction(defaultright) possible values:left,right,random-onUpdatecallback function, returns the output string -onCompletecallback function, returns the output string
glyphs default
!#$&%()*+0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuüvwxyz{|}~License
MIT, see LICENSE for details.
