Code Monkey home page Code Monkey logo

txt-shuffle's Introduction

txt-shuffle

Customisable text shuffling animations.

txt-shuffle-demo

Install

npm install txt-shuffle

Example

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 world

Demo

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 (default 1) duration of shuffle/resolve animation in seconds
    • delay (default 0) delay to start shuffling
    • delayResolve (default 0.2) delay to start resolving
    • fps (default 60) framerate
    • glyphs (see below) glyphs to use in the shuffle animation
    • animation (default show) possible values: show, hide, stay
    • direction (default right) possible values: left, right, random
    • onUpdate callback function, returns the output string
    • onComplete callback function, returns the output string

glyphs default

 !#$&%()*+0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuüvwxyz{|}~

License

MIT, see LICENSE for details.

txt-shuffle's People

Contributors

brunoimbrizi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.