Tiny JavaScript Library For Text Typewriter Effect – js-printer

Category: Animation , Javascript | August 21, 2015
Author:Zhiqing-Lee
Views Total:761 views
Official Page:Go to website
Last Update:August 21, 2015
License:MIT

Preview:

Tiny JavaScript Library For Text Typewriter Effect – js-printer

Description:

js-printer is a standalone and very small JavaScript library which enables you to present text letter by letter like a typewriter.

How to use it:

Load the JS file printer.js in your html page.

<script src="javascript/printer.js"></script>

Create text you want to present and specify the output container.

var str = 'echo Welcome!\n';
    str += 'echo This is a demo of js-printer\n';
    str += 'echo Thanks!\n';
    str += 'exit\n';
    Printer.init(str, {
      selector: 'show-board', // target container
      lnStr: '[email protected] ~/ # ' // prefix
    }).print();

Available options with defautls.

// animation speed
"speed" : 50,
// target container ID
"selector" : 'canvas',
// initial character
"startIndex" : 0,
// last character
"endIndex" : 0,
// cursor options
"hasCur" : true,
"curId" : 'cur',
"curStr" : '_',
"curStyle" : 'font-weight: bold;',
"curSpeed" : 100,
// prefix
"lnStr": ""

You Might Be Interested In:


Leave a Reply