Shuffle Letters Effect In Pure JavaScript – shuffle-letters.js

Category: Animation , Javascript , Text | July 17, 2016
Author: yuheiy
Views Total: 4,230
Official Page: Go to website
Last Update: July 17, 2016
License: MIT

Preview:

Shuffle Letters Effect In Pure JavaScript – shuffle-letters.js

Description:

shuffle-letters.js is a lightweight, dependency-free JavaScript library that allows you to print text with a typing animation by shuffling the text letter by letter.

How to use it:

Insert the shuffle-letters.js library into the document when needed.

<script src="shuffle-letters.js"></script>

Shuffle the text specified in the JavaScript.

shuffleLetters(document.querySelector('.container'), {
  text: 'Lorem ipsum dolor sit amet.'
});

Shuffle the text wrapped in a specific container.

<p class="demo" hidden>Lorem ipsum dolor sit amet</p>
var third = document.querySelectorAll('.demo');
    for (var i = 0; i < third.length; i++) {
      third[i].hidden = false;
    }
shuffleLetters(third);

Customize the text shuffle effect.

shuffleLetters(document.querySelector('.container'), {
  text: 'Lorem ipsum dolor sit amet.'
  step: 1, // How many times should the letters be changed
  fps: 15 // Frames Per Second
});

You Might Be Interested In:

Leave a Reply